@tap-payments/auth-jsconnect 2.0.66-test → 2.0.67-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.
- package/build/@types/form.d.ts +1 -0
- package/build/api/lead.d.ts +1 -1
- package/build/features/app/business/businessStore.js +5 -2
- package/build/features/app/entity/entityStore.js +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -1
- package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
- package/build/features/business/screens/BusinessType/EntityName.js +39 -0
- package/build/features/business/screens/BusinessType/LicenseList.js +9 -4
- package/build/features/business/screens/BusinessType/validation.d.ts +3 -0
- package/build/features/business/screens/BusinessType/validation.js +14 -1
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
package/build/api/lead.d.ts
CHANGED
|
@@ -437,8 +437,10 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
437
437
|
license_type: ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL ? 'freelance' : 'commercial_registration',
|
|
438
438
|
business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
|
|
439
439
|
step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
|
|
440
|
+
business: { ar: params.entityLegalName, en: params.entityLegalName },
|
|
440
441
|
encryption_contract: ['license_number', 'business_type', 'license_type']
|
|
441
442
|
};
|
|
443
|
+
console.log(payload, 'payload', params.entityLegalName);
|
|
442
444
|
return [4, API.leadService.updateLead(payload)];
|
|
443
445
|
case 1:
|
|
444
446
|
data = _h.sent();
|
|
@@ -640,12 +642,13 @@ var initialState = {
|
|
|
640
642
|
type: ''
|
|
641
643
|
},
|
|
642
644
|
businessTypeData: {
|
|
643
|
-
licenseNumber: ''
|
|
645
|
+
licenseNumber: '',
|
|
646
|
+
entityLegalName: ''
|
|
644
647
|
},
|
|
645
648
|
activitiesData: {
|
|
646
649
|
activities: [],
|
|
647
650
|
salesChannels: [],
|
|
648
|
-
operationStartDate:
|
|
651
|
+
operationStartDate: new Date().toString()
|
|
649
652
|
},
|
|
650
653
|
customersData: {
|
|
651
654
|
customerLocations: [],
|
|
@@ -42,7 +42,8 @@ var BusinessType = function (_a) {
|
|
|
42
42
|
var onSubmit = function (data) {
|
|
43
43
|
var dataValues = {
|
|
44
44
|
selectedLicense: data.selectedLicense,
|
|
45
|
-
licenseNumber: data.licenseNumber
|
|
45
|
+
licenseNumber: data.licenseNumber,
|
|
46
|
+
entityLegalName: data.entityLegalName
|
|
46
47
|
};
|
|
47
48
|
dispatch(updateLeadBusinessType(dataValues));
|
|
48
49
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
14
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
15
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
16
|
+
import Input from '../../../shared/Input';
|
|
17
|
+
import Collapse from '../../../../components/Collapse';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
20
|
+
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
21
|
+
var EntityName = function (_a) {
|
|
22
|
+
var _b;
|
|
23
|
+
var show = _a.show;
|
|
24
|
+
var t = useTranslation().t;
|
|
25
|
+
var control = useFormContext().control;
|
|
26
|
+
var entityNameControl = useController({ control: control, name: 'entityLegalName' });
|
|
27
|
+
var entityNameValue = entityNameControl.field.value;
|
|
28
|
+
var error = (_b = entityNameControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
29
|
+
var handleChange = function (_a) {
|
|
30
|
+
var target = _a.target;
|
|
31
|
+
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
32
|
+
entityNameControl.field.onChange(value);
|
|
33
|
+
};
|
|
34
|
+
var clearEntityName = function () {
|
|
35
|
+
entityNameControl.field.onChange('');
|
|
36
|
+
};
|
|
37
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: _jsx(Input, { label: t('entity_legal_name_title'), onChange: handleChange, value: entityNameValue, endAdornment: (entityNameValue === null || entityNameValue === void 0 ? void 0 : entityNameValue.length) >= 3 ? _jsx(CheckIcon, {}) : entityNameValue && _jsx(ClearIcon, { onClick: clearEntityName }), placeholder: t('entity_legal_name_placeholder'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
|
|
38
|
+
};
|
|
39
|
+
export default EntityName;
|
|
@@ -37,6 +37,9 @@ import Text from '../../../../components/Text';
|
|
|
37
37
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
38
38
|
import Collapse from '../../../../components/Collapse';
|
|
39
39
|
import LicenseNumber from './LicenseNumber';
|
|
40
|
+
import EntityName from '../../../../features/business/screens/BusinessType/EntityName';
|
|
41
|
+
import { isKW } from '../../../../utils';
|
|
42
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
40
43
|
var InputStyled = styled(Input)(function (_a) {
|
|
41
44
|
var theme = _a.theme;
|
|
42
45
|
return ({
|
|
@@ -54,14 +57,16 @@ var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
54
57
|
return (__assign(__assign({ display: 'flex', color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
55
58
|
});
|
|
56
59
|
var LicenseList = function (_a) {
|
|
60
|
+
var _b;
|
|
57
61
|
var rest = __rest(_a, []);
|
|
58
|
-
var
|
|
62
|
+
var _c = useAppSelector(businessSelector), data = _c.data, error = _c.error;
|
|
63
|
+
var settingData = useAppSelector(settingsSelector).data;
|
|
59
64
|
var businessTypeData = data.businessTypeData;
|
|
60
|
-
var
|
|
65
|
+
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
61
66
|
var t = useTranslation().t;
|
|
62
67
|
var isAr = useLanguage().isAr;
|
|
63
68
|
var dispatch = useAppDispatch();
|
|
64
|
-
var
|
|
69
|
+
var _e = useFormContext(), setValue = _e.setValue, control = _e.control;
|
|
65
70
|
var selectedLicenseControl = useController({ control: control, name: 'selectedLicense' });
|
|
66
71
|
var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense, licenseNumber = businessTypeData.licenseNumber;
|
|
67
72
|
var licenseList = (responseBody || { licenseList: [] }).licenseList;
|
|
@@ -123,6 +128,6 @@ var LicenseList = function (_a) {
|
|
|
123
128
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
124
129
|
return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, 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) {
|
|
125
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, {})] }));
|
|
126
|
-
} }) })), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: licenseReadonly })] }));
|
|
131
|
+
} }) })), _jsx(EntityName, { show: showLicenseNumber && isKW((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.country_code) }), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: licenseReadonly })] }));
|
|
127
132
|
};
|
|
128
133
|
export default React.memo(LicenseList);
|
|
@@ -2,10 +2,13 @@ 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
4
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
|
+
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
6
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
6
7
|
selectedLicense: any;
|
|
7
8
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
9
|
+
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
10
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
9
11
|
selectedLicense: any;
|
|
10
12
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
13
|
+
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
14
|
}>>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { FL_NUMBER_LENGTH, CR_NUMBER_LENGTH } from '../../../../constants';
|
|
2
|
+
import { FL_NUMBER_LENGTH, CR_NUMBER_LENGTH, REGEX_BRAND_NAME } from '../../../../constants';
|
|
3
3
|
import { BusinessType } from '../../../../@types';
|
|
4
4
|
var objectElements = {
|
|
5
5
|
legal_name: yup.object().shape({
|
|
@@ -27,6 +27,19 @@ export var LicenseValidationSchema = yup.object().shape({
|
|
|
27
27
|
}
|
|
28
28
|
return length === FL_NUMBER_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
29
29
|
}
|
|
30
|
+
})
|
|
31
|
+
.required(''),
|
|
32
|
+
entityLegalName: yup
|
|
33
|
+
.string()
|
|
34
|
+
.test({
|
|
35
|
+
test: function (value) {
|
|
36
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
37
|
+
if (length === 0)
|
|
38
|
+
return true;
|
|
39
|
+
return !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)) || (value === null || value === void 0 ? void 0 : value.length) < 3
|
|
40
|
+
? this.createError({ message: 'enter_entity_name_english_chars_numbers_space' })
|
|
41
|
+
: true;
|
|
42
|
+
}
|
|
30
43
|
})
|
|
31
44
|
.required('')
|
|
32
45
|
});
|