@tap-payments/auth-jsconnect 2.11.0-development → 2.11.0-sandbox
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.
- package/build/@types/form.d.ts +0 -2
- package/build/api/entity.d.ts +0 -3
- package/build/api/lead.d.ts +0 -1
- package/build/assets/locales/ar.json +10 -9
- package/build/assets/locales/en.json +10 -9
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/app.d.ts +1 -9
- package/build/constants/app.js +4 -6
- package/build/constants/validation.d.ts +0 -1
- package/build/constants/validation.js +0 -1
- package/build/features/app/business/businessStore.js +10 -15
- package/build/features/app/connectExpress/connectExpressStore.js +4 -19
- package/build/features/app/terminal/terminalStore.d.ts +1 -2
- package/build/features/app/terminal/terminalStore.js +2 -5
- package/build/features/auth/Auth.d.ts +1 -1
- package/build/features/auth/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -13
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +5 -11
- package/build/features/business/screens/BusinessType/LicenseList.js +7 -15
- package/build/features/business/screens/BusinessType/validation.d.ts +3 -6
- package/build/features/business/screens/BusinessType/validation.js +10 -31
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +0 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +7 -23
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +3 -6
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +21 -57
- package/build/features/entity/screens/EntityName/EntityName.js +1 -2
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +3 -3
- package/build/features/entity/screens/EntityName/validation.js +3 -14
- package/build/features/shared/Button/FlowsButtons.d.ts +0 -1
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +1 -2
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -3
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +2 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +3 -8
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +1 -3
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +5 -6
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +10 -19
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +2 -7
- package/build/features/terminal/screens/shared/TerminalList.js +3 -3
- package/build/utils/common.js +3 -3
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +2 -2
- package/package.json +2 -2
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +0 -35
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +0 -84
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +0 -36
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +0 -81
|
@@ -36,7 +36,7 @@ import { businessSelector, clearError } from '../../../app/business/businessStor
|
|
|
36
36
|
import Text from '../../../../components/Text';
|
|
37
37
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
38
38
|
import Collapse from '../../../../components/Collapse';
|
|
39
|
-
import { isKW, isOtherLicense
|
|
39
|
+
import { isKW, isOtherLicense } from '../../../../utils';
|
|
40
40
|
import { settingsSelector } from '../../../../app/settings';
|
|
41
41
|
import { OTHER_CR_LICENSE } from '../../../../constants';
|
|
42
42
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
@@ -67,7 +67,6 @@ var EntityLicenseList = function (_a) {
|
|
|
67
67
|
var entityLicenseList = (responseBody || {}).entityLicenseList;
|
|
68
68
|
var country_code = settingsData.businessCountry.iso2;
|
|
69
69
|
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
70
|
-
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
71
70
|
var onOpenLicenseList = function (event) {
|
|
72
71
|
var _a;
|
|
73
72
|
setAnchorEl(event.currentTarget);
|
|
@@ -91,10 +90,8 @@ var EntityLicenseList = function (_a) {
|
|
|
91
90
|
}
|
|
92
91
|
}, [entityLicenseList, selectedEntityLicense]);
|
|
93
92
|
var getLicenseNumber = function (item) {
|
|
94
|
-
var _a
|
|
95
|
-
|
|
96
|
-
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) || '';
|
|
97
|
-
return ((_c = item === null || item === void 0 ? void 0 : item.license) === null || _c === void 0 ? void 0 : _c.number) || '';
|
|
93
|
+
var _a;
|
|
94
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
98
95
|
};
|
|
99
96
|
var getLicenseName = function (item) {
|
|
100
97
|
var _a, _b;
|
|
@@ -103,7 +100,6 @@ var EntityLicenseList = function (_a) {
|
|
|
103
100
|
return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
|
|
104
101
|
};
|
|
105
102
|
var onSelectItem = function (license) {
|
|
106
|
-
var _a, _b, _c;
|
|
107
103
|
if (error)
|
|
108
104
|
dispatch(clearError());
|
|
109
105
|
selectedEntityLicenseControl.field.onChange(license);
|
|
@@ -111,12 +107,10 @@ var EntityLicenseList = function (_a) {
|
|
|
111
107
|
var license_1 = isKWCountry ? OTHER_CR_LICENSE : {};
|
|
112
108
|
setValue('selectedLicense', license_1, { shouldValidate: true });
|
|
113
109
|
setValue('licenseNumber', '', { shouldValidate: true });
|
|
114
|
-
setValue('unifiedNumber', '', { shouldValidate: true });
|
|
115
110
|
}
|
|
116
111
|
else {
|
|
117
112
|
setValue('selectedLicense', license, { shouldValidate: true });
|
|
118
|
-
setValue('licenseNumber', (
|
|
119
|
-
setValue('unifiedNumber', ((_c = (_b = license === null || license === void 0 ? void 0 : license.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '', { shouldValidate: true });
|
|
113
|
+
setValue('licenseNumber', getLicenseNumber(license), { shouldValidate: true });
|
|
120
114
|
}
|
|
121
115
|
onCloseLicenseList();
|
|
122
116
|
};
|
|
@@ -128,7 +122,7 @@ var EntityLicenseList = function (_a) {
|
|
|
128
122
|
var selected = selectedEntityLicenseControl.field.value;
|
|
129
123
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
130
124
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
131
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_entity_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_entity'), value:
|
|
125
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_entity_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_entity'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: entityLicenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
132
126
|
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, {})] }));
|
|
133
127
|
} }) }))] }) })));
|
|
134
128
|
};
|
|
@@ -36,7 +36,7 @@ import { businessSelector, clearError } from '../../../app/business/businessStor
|
|
|
36
36
|
import Text from '../../../../components/Text';
|
|
37
37
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
38
38
|
import Collapse from '../../../../components/Collapse';
|
|
39
|
-
import { isKW, isOtherLicense
|
|
39
|
+
import { isKW, isOtherLicense } from '../../../../utils';
|
|
40
40
|
import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
|
|
41
41
|
import { settingsSelector } from '../../../../app/settings';
|
|
42
42
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
@@ -66,7 +66,6 @@ var LicenseList = function (_a) {
|
|
|
66
66
|
var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense, licenseNumber = businessTypeData.licenseNumber, entityLegalName = businessTypeData.entityLegalName;
|
|
67
67
|
var licenseList = (responseBody || { licenseList: [] }).licenseList;
|
|
68
68
|
var country_code = settingsData.businessCountry.iso2;
|
|
69
|
-
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
70
69
|
var onOpenLicenseList = function (event) {
|
|
71
70
|
var _a;
|
|
72
71
|
setAnchorEl(event.currentTarget);
|
|
@@ -100,10 +99,8 @@ var LicenseList = function (_a) {
|
|
|
100
99
|
}
|
|
101
100
|
}, [country_code]);
|
|
102
101
|
var getLicenseNumber = function (item) {
|
|
103
|
-
var _a
|
|
104
|
-
|
|
105
|
-
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) || '';
|
|
106
|
-
return ((_c = item === null || item === void 0 ? void 0 : item.license) === null || _c === void 0 ? void 0 : _c.number) || '';
|
|
102
|
+
var _a;
|
|
103
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
107
104
|
};
|
|
108
105
|
var getLicenseName = function (item) {
|
|
109
106
|
var _a, _b;
|
|
@@ -112,18 +109,13 @@ var LicenseList = function (_a) {
|
|
|
112
109
|
return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
|
|
113
110
|
};
|
|
114
111
|
var onSelectItem = function (license) {
|
|
115
|
-
var _a, _b, _c;
|
|
116
112
|
if (error)
|
|
117
113
|
dispatch(clearError());
|
|
118
114
|
selectedLicenseControl.field.onChange(license);
|
|
119
|
-
if (isOtherLicense(license))
|
|
115
|
+
if (isOtherLicense(license))
|
|
120
116
|
setValue('licenseNumber', '', { shouldValidate: true });
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
else {
|
|
124
|
-
setValue('licenseNumber', ((_a = license === null || license === void 0 ? void 0 : license.license) === null || _a === void 0 ? void 0 : _a.number) || '', { shouldValidate: true });
|
|
125
|
-
setValue('unifiedNumber', ((_c = (_b = license === null || license === void 0 ? void 0 : license.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '', { shouldValidate: true });
|
|
126
|
-
}
|
|
117
|
+
else
|
|
118
|
+
setValue('licenseNumber', getLicenseNumber(license), { shouldValidate: true });
|
|
127
119
|
onCloseLicenseList();
|
|
128
120
|
};
|
|
129
121
|
var getLicenseFullName = function (item) {
|
|
@@ -134,7 +126,7 @@ var LicenseList = function (_a) {
|
|
|
134
126
|
var selected = selectedLicenseControl.field.value;
|
|
135
127
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
136
128
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
137
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value:
|
|
129
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), 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) {
|
|
138
130
|
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, {})] }));
|
|
139
131
|
} }) }))] }) })));
|
|
140
132
|
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare const LicenseValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
3
|
selectedLicense: any;
|
|
4
|
-
|
|
5
|
-
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
4
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
5
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
6
|
selectedLicense: any;
|
|
8
|
-
|
|
9
|
-
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
7
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
8
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
11
9
|
selectedLicense: any;
|
|
12
|
-
|
|
13
|
-
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
10
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
14
11
|
}>>>;
|
|
15
12
|
export declare const KWLicenseValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
16
13
|
selectedLicense: any;
|
|
@@ -1,55 +1,34 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { REGEX_BRAND_NAME, KW_MIN_LICENSE_LENGTH, MAX_FILE_SIZE, VALID_FILE_FORMATS, FL_MIN_LICENSE_LENGTH,
|
|
2
|
+
import { REGEX_BRAND_NAME, KW_MIN_LICENSE_LENGTH, MAX_FILE_SIZE, VALID_FILE_FORMATS, FL_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
3
3
|
import { BusinessType } from '../../../../@types';
|
|
4
|
-
import { isOtherLicense } from '../../../../utils';
|
|
5
4
|
var objectElements = {
|
|
6
5
|
legal_name: yup.object().shape({
|
|
7
6
|
ar: yup.string(),
|
|
8
7
|
en: yup.string()
|
|
9
8
|
}),
|
|
10
9
|
license: yup.object().shape({
|
|
11
|
-
number: yup.string()
|
|
10
|
+
number: yup.string()
|
|
12
11
|
}),
|
|
13
12
|
type: yup.string()
|
|
14
13
|
};
|
|
15
14
|
export var LicenseValidationSchema = yup.object().shape({
|
|
16
15
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
test: function (value) {
|
|
21
|
-
var _a;
|
|
22
|
-
var selectedEntityLicense = this.parent.selectedEntityLicense;
|
|
23
|
-
var selectedLicense = this.parent.selectedLicense;
|
|
24
|
-
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
25
|
-
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
26
|
-
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
27
|
-
return false;
|
|
28
|
-
if (isFL || !isOtherLicense(selectedEntityLicense))
|
|
29
|
-
return true;
|
|
30
|
-
if (length === 0)
|
|
31
|
-
return this.createError({ message: '' });
|
|
32
|
-
return length >= UNIFIED_NUMBER_MIN_LENGTH ? true : this.createError({ message: 'unified_number_required' });
|
|
33
|
-
}
|
|
34
|
-
}),
|
|
35
|
-
licenseNumber: yup.string().test({
|
|
36
|
-
name: 'licenseNumber',
|
|
37
|
-
message: '',
|
|
16
|
+
licenseNumber: yup
|
|
17
|
+
.string()
|
|
18
|
+
.test({
|
|
38
19
|
test: function (value) {
|
|
39
|
-
var _a;
|
|
40
20
|
var selectedLicense = this.parent.selectedLicense;
|
|
41
|
-
var selectedEntityLicense = this.parent.selectedEntityLicense;
|
|
42
21
|
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
43
22
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
44
|
-
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
45
|
-
return false;
|
|
46
|
-
if (isCR || !isOtherLicense(selectedEntityLicense))
|
|
47
|
-
return true;
|
|
48
23
|
if (length === 0)
|
|
49
|
-
return
|
|
24
|
+
return true;
|
|
25
|
+
if (isCR) {
|
|
26
|
+
return length >= CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
|
|
27
|
+
}
|
|
50
28
|
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
51
29
|
}
|
|
52
30
|
})
|
|
31
|
+
.required('')
|
|
53
32
|
});
|
|
54
33
|
export var KWLicenseValidationSchema = yup.object().shape({
|
|
55
34
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
@@ -75,8 +75,8 @@ var EntityList = function (_a) {
|
|
|
75
75
|
var selectedEntityControl = useController({ control: control, name: 'entityInfo' });
|
|
76
76
|
React.useEffect(function () {
|
|
77
77
|
if (entityList.length > 0) {
|
|
78
|
-
var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; })
|
|
79
|
-
var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false);
|
|
78
|
+
var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; });
|
|
79
|
+
var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false) || [];
|
|
80
80
|
setList(list_1);
|
|
81
81
|
if (filteredEntityList.length) {
|
|
82
82
|
setValue('entityInfo', filteredEntityList[0], { shouldValidate: true });
|
|
@@ -78,7 +78,6 @@ var CollectBusinessInfo = function (_a) {
|
|
|
78
78
|
var onSubmit = function (data) {
|
|
79
79
|
var dataValues = {
|
|
80
80
|
brandName: data.brandName,
|
|
81
|
-
unifiedNumber: data.unifiedNumber,
|
|
82
81
|
selectedLicense: data.selectedLicense,
|
|
83
82
|
licenseNumber: data.licenseNumber,
|
|
84
83
|
termAndConditionChecked: data.termAndConditionChecked
|
|
@@ -41,7 +41,6 @@ import CheckIcon from '../../../shared/CheckIcon';
|
|
|
41
41
|
import { connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
|
|
42
42
|
import LicenseNumber from './LicenseNumber';
|
|
43
43
|
import LicenseType from './LicenseType';
|
|
44
|
-
import UnifiedNumber from './UnifiedNumber';
|
|
45
44
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
46
45
|
var theme = _a.theme;
|
|
47
46
|
return ({
|
|
@@ -105,10 +104,8 @@ var LicenseList = function (_a) {
|
|
|
105
104
|
}
|
|
106
105
|
}, [country_code]);
|
|
107
106
|
var getLicenseNumber = function (item) {
|
|
108
|
-
var _a
|
|
109
|
-
|
|
110
|
-
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) || '';
|
|
111
|
-
return ((_c = item === null || item === void 0 ? void 0 : item.license) === null || _c === void 0 ? void 0 : _c.number) || '';
|
|
107
|
+
var _a;
|
|
108
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
112
109
|
};
|
|
113
110
|
var getLicenseName = function (item) {
|
|
114
111
|
var _a, _b;
|
|
@@ -117,18 +114,13 @@ var LicenseList = function (_a) {
|
|
|
117
114
|
return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
|
|
118
115
|
};
|
|
119
116
|
var onSelectItem = function (license) {
|
|
120
|
-
var _a, _b, _c;
|
|
121
117
|
if (error)
|
|
122
118
|
dispatch(clearError());
|
|
123
119
|
selectedLicenseControl.field.onChange(license);
|
|
124
|
-
if (isOtherLicense(license))
|
|
120
|
+
if (isOtherLicense(license))
|
|
125
121
|
setValue('licenseNumber', '', { shouldValidate: true });
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
else {
|
|
129
|
-
setValue('licenseNumber', ((_a = license === null || license === void 0 ? void 0 : license.license) === null || _a === void 0 ? void 0 : _a.number) || '', { shouldValidate: true });
|
|
130
|
-
setValue('unifiedNumber', ((_c = (_b = license === null || license === void 0 ? void 0 : license.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '', { shouldValidate: true });
|
|
131
|
-
}
|
|
122
|
+
else
|
|
123
|
+
setValue('licenseNumber', getLicenseNumber(license), { shouldValidate: true });
|
|
132
124
|
onCloseLicenseList();
|
|
133
125
|
};
|
|
134
126
|
var getLicenseFullName = function (item) {
|
|
@@ -136,21 +128,13 @@ var LicenseList = function (_a) {
|
|
|
136
128
|
return _jsx("span", { children: "".concat(getLicenseName(item), " - ").concat(getLicenseNumber(item)) });
|
|
137
129
|
return _jsx("span", { children: "".concat(getLicenseNumber(item), " - ").concat(getLicenseName(item)) });
|
|
138
130
|
};
|
|
139
|
-
var showLicenseNumber = function () {
|
|
140
|
-
if (isKWCountry)
|
|
141
|
-
return show && isCR;
|
|
142
|
-
if (isSACountry)
|
|
143
|
-
return show && isFL;
|
|
144
|
-
return show;
|
|
145
|
-
};
|
|
146
131
|
var show = !anchorEl;
|
|
147
132
|
var selected = selectedLicenseControl.field.value;
|
|
148
133
|
var licenseReadonly = !isOtherLicense(selected);
|
|
149
134
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
150
|
-
var isFL = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.FL;
|
|
151
135
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
152
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry || isOtherThanKWOrSACountry }, { 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:
|
|
136
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry || isOtherThanKWOrSACountry }, { 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) {
|
|
153
137
|
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, {})] }));
|
|
154
|
-
} }) }))] })), _jsx(LicenseType, { show: show && isKWCountry, readOnly: readOnly }), _jsx(LicenseNumber, { show:
|
|
138
|
+
} }) }))] })), _jsx(LicenseType, { show: show && isKWCountry, readOnly: readOnly }), _jsx(LicenseNumber, { show: isKWCountry ? isCR : show, readOnly: licenseReadonly })] }));
|
|
155
139
|
};
|
|
156
140
|
export default React.memo(LicenseList);
|
|
@@ -42,12 +42,12 @@ var LicenseNumber = function (_a) {
|
|
|
42
42
|
var clearLicenseNumber = function () {
|
|
43
43
|
licenseNumberControl.field.onChange('');
|
|
44
44
|
};
|
|
45
|
-
var licenseNumberValue = licenseNumberControl.field.value
|
|
45
|
+
var licenseNumberValue = licenseNumberControl.field.value;
|
|
46
46
|
var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
47
47
|
var length = isKWCountry || isOtherThanKWOrSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_MAX_LENGTH;
|
|
48
48
|
var minLength = isKWCountry || isOtherThanKWOrSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
|
|
49
49
|
var label = isCR ? 'cr_number' : 'fl_number';
|
|
50
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,
|
|
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 }) }) }) })));
|
|
52
52
|
};
|
|
53
53
|
export default React.memo(LicenseNumber);
|
|
@@ -77,6 +77,6 @@ var TAC = function (_a) {
|
|
|
77
77
|
return;
|
|
78
78
|
tacControl.field.onChange(checked);
|
|
79
79
|
};
|
|
80
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: {
|
|
80
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(TACContainerStyled, __assign({ readOnly: readOnly }, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] })), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })) })));
|
|
81
81
|
};
|
|
82
82
|
export default React.memo(TAC);
|
|
@@ -15,18 +15,15 @@ export declare const OtherThanKWOrSABusinessDataSchema: (isLeadIdPassed: boolean
|
|
|
15
15
|
export declare const BusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
16
16
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
17
17
|
selectedLicense: any;
|
|
18
|
-
|
|
19
|
-
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
20
19
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
21
20
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
22
21
|
selectedLicense: any;
|
|
23
|
-
|
|
24
|
-
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
25
23
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
26
24
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
27
25
|
selectedLicense: any;
|
|
28
|
-
|
|
29
|
-
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
26
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
30
27
|
}>>>;
|
|
31
28
|
export declare const KWBusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
32
29
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH,
|
|
2
|
+
import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH, BRAND_NAME_MAX_LENGTH } from '../../../../constants';
|
|
3
3
|
import { BusinessType } from '../../../../@types';
|
|
4
4
|
var objectElements = {
|
|
5
5
|
legal_name: yup.object().shape({
|
|
@@ -7,7 +7,7 @@ var objectElements = {
|
|
|
7
7
|
en: yup.string()
|
|
8
8
|
}),
|
|
9
9
|
license: yup.object().shape({
|
|
10
|
-
number: yup.string()
|
|
10
|
+
number: yup.string()
|
|
11
11
|
}),
|
|
12
12
|
type: yup.string()
|
|
13
13
|
};
|
|
@@ -94,40 +94,22 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
94
94
|
})
|
|
95
95
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
96
96
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
test: function (value) {
|
|
101
|
-
var _a;
|
|
102
|
-
var selectedLicense = this.parent.selectedLicense;
|
|
103
|
-
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
104
|
-
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
105
|
-
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
106
|
-
return false;
|
|
107
|
-
if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
108
|
-
return true;
|
|
109
|
-
if (length === 0)
|
|
110
|
-
return this.createError({ message: '' });
|
|
111
|
-
return this.createError({ message: 'unified_number_required' });
|
|
112
|
-
}
|
|
113
|
-
}),
|
|
114
|
-
licenseNumber: yup.string().test({
|
|
115
|
-
name: 'licenseNumber',
|
|
116
|
-
message: '',
|
|
97
|
+
licenseNumber: yup
|
|
98
|
+
.string()
|
|
99
|
+
.test({
|
|
117
100
|
test: function (value) {
|
|
118
|
-
var _a;
|
|
119
101
|
var selectedLicense = this.parent.selectedLicense;
|
|
120
102
|
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
121
103
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
122
|
-
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
123
|
-
return false;
|
|
124
|
-
if (isCR || length >= FL_MIN_LICENSE_LENGTH)
|
|
125
|
-
return true;
|
|
126
104
|
if (length === 0)
|
|
127
|
-
return
|
|
128
|
-
|
|
105
|
+
return true;
|
|
106
|
+
if (isCR) {
|
|
107
|
+
return length >= CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
|
|
108
|
+
}
|
|
109
|
+
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
129
110
|
}
|
|
130
|
-
})
|
|
111
|
+
})
|
|
112
|
+
.required(''),
|
|
131
113
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond')
|
|
132
114
|
});
|
|
133
115
|
}
|
|
@@ -145,40 +127,22 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
145
127
|
})
|
|
146
128
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
147
129
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
test: function (value) {
|
|
152
|
-
var _a;
|
|
153
|
-
var selectedLicense = this.parent.selectedLicense;
|
|
154
|
-
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
155
|
-
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
156
|
-
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
157
|
-
return false;
|
|
158
|
-
if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
159
|
-
return true;
|
|
160
|
-
if (length === 0)
|
|
161
|
-
return this.createError({ message: '' });
|
|
162
|
-
return this.createError({ message: 'unified_number_required' });
|
|
163
|
-
}
|
|
164
|
-
}),
|
|
165
|
-
licenseNumber: yup.string().test({
|
|
166
|
-
name: 'licenseNumber',
|
|
167
|
-
message: '',
|
|
130
|
+
licenseNumber: yup
|
|
131
|
+
.string()
|
|
132
|
+
.test({
|
|
168
133
|
test: function (value) {
|
|
169
|
-
var _a;
|
|
170
134
|
var selectedLicense = this.parent.selectedLicense;
|
|
171
135
|
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
172
136
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
173
|
-
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
174
|
-
return false;
|
|
175
|
-
if (isCR || length >= FL_MIN_LICENSE_LENGTH)
|
|
176
|
-
return true;
|
|
177
137
|
if (length === 0)
|
|
178
|
-
return
|
|
179
|
-
|
|
138
|
+
return true;
|
|
139
|
+
if (isCR) {
|
|
140
|
+
return length >= CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
|
|
141
|
+
}
|
|
142
|
+
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
180
143
|
}
|
|
181
144
|
})
|
|
145
|
+
.required('')
|
|
182
146
|
});
|
|
183
147
|
};
|
|
184
148
|
export var KWBusinessDataSchema = function (isLeadIdPassed) {
|
|
@@ -155,9 +155,8 @@ var EntityName = function (_a) {
|
|
|
155
155
|
}, [methods.formState.isValid]);
|
|
156
156
|
var disabled = !methods.formState.isValid || uploading || uploadingArticle;
|
|
157
157
|
var showLicenseNumber = isKWCountry ? isCR : true;
|
|
158
|
-
var showExpiryDate = isSACountry ? !isCR : true;
|
|
159
158
|
var showUnifiedNumber = isSACountry ? isCR : false;
|
|
160
159
|
var disableBack = settingsData.appConfig.mode === 'content';
|
|
161
|
-
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(
|
|
160
|
+
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 ? false : !isKWCountry || isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: !isSACountry, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
162
161
|
};
|
|
163
162
|
export default EntityName;
|
|
@@ -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 { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
|
-
import {
|
|
17
|
+
import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
18
18
|
import Collapse from '../../../../components/Collapse';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
@@ -31,7 +31,7 @@ var UnifiedNumber = function (_a) {
|
|
|
31
31
|
var target = _a.target;
|
|
32
32
|
if (bckError)
|
|
33
33
|
dispatch(clearError());
|
|
34
|
-
var value =
|
|
34
|
+
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
35
35
|
unifiedNumberControl.field.onChange(value);
|
|
36
36
|
};
|
|
37
37
|
var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
|
|
@@ -6,7 +6,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
6
6
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
7
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
8
8
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
9
|
-
expiryDate: yup.
|
|
9
|
+
expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
10
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
11
11
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
12
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -16,7 +16,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
16
16
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
17
17
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
18
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
19
|
-
expiryDate: yup.
|
|
19
|
+
expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
20
20
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
21
21
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
22
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -26,7 +26,7 @@ export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("
|
|
|
26
26
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
27
27
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
28
28
|
issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
29
|
-
expiryDate: yup.
|
|
29
|
+
expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
30
30
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
31
31
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
32
|
}>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { BusinessType } from '../../../../@types';
|
|
3
|
-
import { KW_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH
|
|
3
|
+
import { KW_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
4
4
|
export var EntityNameValidationSchema = function () {
|
|
5
5
|
return yup.object().shape({
|
|
6
6
|
legalName: yup
|
|
@@ -32,20 +32,9 @@ export var EntityNameValidationSchema = function () {
|
|
|
32
32
|
}
|
|
33
33
|
})
|
|
34
34
|
.required(''),
|
|
35
|
-
unifiedNumber: yup.string().
|
|
36
|
-
name: 'unifiedNumber',
|
|
37
|
-
message: '',
|
|
38
|
-
test: function (value) {
|
|
39
|
-
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
40
|
-
if (length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
41
|
-
return true;
|
|
42
|
-
if (length === 0)
|
|
43
|
-
return this.createError({ message: '' });
|
|
44
|
-
return this.createError({ message: 'unified_number_required' });
|
|
45
|
-
}
|
|
46
|
-
}),
|
|
35
|
+
unifiedNumber: yup.string().optional(),
|
|
47
36
|
issuingDate: yup.string().required('choose_any_issuing_date'),
|
|
48
|
-
expiryDate: yup.string().
|
|
37
|
+
expiryDate: yup.string().required('choose_any_expiry_date'),
|
|
49
38
|
certificateId: yup.array().optional(),
|
|
50
39
|
articleId: yup.string().optional()
|
|
51
40
|
});
|
|
@@ -177,7 +177,7 @@ export default function FlowsButtons(_a) {
|
|
|
177
177
|
});
|
|
178
178
|
if (flowName === item.name && !isResetPassword(item.name, item.status)) {
|
|
179
179
|
var isOtherThanSAOrKWCountry = !isKWOrSA(settingsData.businessCountry.iso2);
|
|
180
|
-
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry
|
|
180
|
+
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry)));
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
if (typeof settingsData.appConfig.onBoardButtonClick === 'function') {
|
|
@@ -19,7 +19,6 @@ interface SuccessFlowButtonsProps {
|
|
|
19
19
|
onClose?: () => void;
|
|
20
20
|
loading?: boolean;
|
|
21
21
|
status: 'complete' | 'incomplete';
|
|
22
|
-
terminalStepName?: string;
|
|
23
22
|
}
|
|
24
|
-
declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status
|
|
23
|
+
declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status }: SuccessFlowButtonsProps) => JSX.Element>;
|
|
25
24
|
export default _default;
|