@tap-payments/auth-jsconnect 2.11.9-development → 2.11.10-development
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.
|
@@ -54,12 +54,23 @@ var EntityName = function (_a) {
|
|
|
54
54
|
var isCR = licenseType === BusinessType.CR;
|
|
55
55
|
var _j = data.verify.responseBody || {}, entity = _j.entity, flows = _j.flows, entityTypes = _j.entityTypes;
|
|
56
56
|
var _k = entity || {}, AOA_file = _k.AOA_file, id = _k.id, documents = _k.documents, data_status = _k.data_status, data_verification = _k.data_verification, legal_name = _k.legal_name, type = _k.type, license = _k.license;
|
|
57
|
+
var noneEditable = useDataNoneEditable(data_status, [
|
|
58
|
+
'legal_name.en',
|
|
59
|
+
'legal_name.ar',
|
|
60
|
+
'type',
|
|
61
|
+
'license.number',
|
|
62
|
+
'license.additional_info',
|
|
63
|
+
'license.issuing_date',
|
|
64
|
+
'license.expiry_date',
|
|
65
|
+
'documents',
|
|
66
|
+
'AOA_file_id'
|
|
67
|
+
]);
|
|
57
68
|
var getSchema = function () {
|
|
58
69
|
if (isSACountry)
|
|
59
|
-
return EntityNameValidationSchema();
|
|
70
|
+
return EntityNameValidationSchema(noneEditable);
|
|
60
71
|
if (isKWCountry)
|
|
61
|
-
return EntityNameKWValidationSchema();
|
|
62
|
-
return EntityNameOtherCountryValidationSchema();
|
|
72
|
+
return EntityNameKWValidationSchema(noneEditable);
|
|
73
|
+
return EntityNameOtherCountryValidationSchema(noneEditable);
|
|
63
74
|
};
|
|
64
75
|
var methods = useForm({
|
|
65
76
|
resolver: yupResolver(getSchema()),
|
|
@@ -93,17 +104,6 @@ var EntityName = function (_a) {
|
|
|
93
104
|
articleId: defaultArticleFile === null || defaultArticleFile === void 0 ? void 0 : defaultArticleFile.id
|
|
94
105
|
}).isDirty;
|
|
95
106
|
var originalReadOnly = useFormReadOnly(methods, { certificateId: defaultCertificateFiles, articleId: defaultArticleFile });
|
|
96
|
-
var noneEditable = useDataNoneEditable(data_status, [
|
|
97
|
-
'legal_name.en',
|
|
98
|
-
'legal_name.ar',
|
|
99
|
-
'type',
|
|
100
|
-
'license.number',
|
|
101
|
-
'license.additional_info',
|
|
102
|
-
'license.issuing_date',
|
|
103
|
-
'license.expiry_date',
|
|
104
|
-
'documents',
|
|
105
|
-
'AOA_file_id'
|
|
106
|
-
]);
|
|
107
107
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
108
108
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
109
109
|
var dataVerified = useDataVerified(data_verification, [
|
|
@@ -1,88 +1,90 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare type NonEditableMap = Record<string, boolean>;
|
|
3
|
+
export declare const EntityNameValidationSchema: (noneEditable: NonEditableMap) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
4
5
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
5
|
-
entityType:
|
|
6
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
6
7
|
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
7
8
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
8
|
-
issuingDate:
|
|
9
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
9
10
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
10
11
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
11
12
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
13
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
13
|
-
legalName:
|
|
14
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
14
15
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
15
|
-
entityType:
|
|
16
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
16
17
|
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
18
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
|
-
issuingDate:
|
|
19
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
19
20
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
21
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
21
22
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
23
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
23
|
-
legalName:
|
|
24
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
24
25
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
|
-
entityType:
|
|
26
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
26
27
|
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
27
28
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
28
|
-
issuingDate:
|
|
29
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
29
30
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
30
31
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
31
32
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
33
|
}>>>;
|
|
33
|
-
export declare const EntityNameKWValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
34
|
-
legalName:
|
|
34
|
+
export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
35
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
35
36
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
36
|
-
entityType:
|
|
37
|
-
licenseNumber:
|
|
38
|
-
issuingDate:
|
|
39
|
-
expiryDate:
|
|
37
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
38
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
39
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
40
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
40
41
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
41
42
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
42
43
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
43
|
-
legalName:
|
|
44
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
44
45
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
45
|
-
entityType:
|
|
46
|
-
licenseNumber:
|
|
47
|
-
issuingDate:
|
|
48
|
-
expiryDate:
|
|
46
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
47
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
48
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
49
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
49
50
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
50
51
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
51
52
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
52
|
-
legalName:
|
|
53
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
53
54
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
54
|
-
entityType:
|
|
55
|
-
licenseNumber:
|
|
56
|
-
issuingDate:
|
|
57
|
-
expiryDate:
|
|
55
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
56
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
57
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
58
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
58
59
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
59
60
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
60
61
|
}>>>;
|
|
61
|
-
export declare const EntityNameOtherCountryValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
62
|
-
legalName:
|
|
62
|
+
export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonEditableMap) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
63
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
63
64
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
64
|
-
entityType:
|
|
65
|
-
licenseNumber:
|
|
66
|
-
issuingDate:
|
|
67
|
-
expiryDate:
|
|
65
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
66
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
67
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
68
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
68
69
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
69
70
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
70
71
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
71
|
-
legalName:
|
|
72
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
72
73
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
73
|
-
entityType:
|
|
74
|
-
licenseNumber:
|
|
75
|
-
issuingDate:
|
|
76
|
-
expiryDate:
|
|
74
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
75
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
76
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
77
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
77
78
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
78
79
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
79
80
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
80
|
-
legalName:
|
|
81
|
+
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
81
82
|
licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
82
|
-
entityType:
|
|
83
|
-
licenseNumber:
|
|
84
|
-
issuingDate:
|
|
85
|
-
expiryDate:
|
|
83
|
+
entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
84
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
85
|
+
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
86
|
+
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
86
87
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
87
88
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
88
89
|
}>>>;
|
|
90
|
+
export {};
|
|
@@ -1,63 +1,56 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { BusinessType } from '../../../../@types';
|
|
3
3
|
import { KW_MIN_LICENSE_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
4
|
-
export var EntityNameValidationSchema = function () {
|
|
4
|
+
export var EntityNameValidationSchema = function (noneEditable) {
|
|
5
5
|
return yup.object().shape({
|
|
6
|
-
legalName:
|
|
7
|
-
.string()
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
legalName: noneEditable['legal_name.en'] && noneEditable['legal_name.ar']
|
|
7
|
+
? yup.string().optional()
|
|
8
|
+
: yup
|
|
9
|
+
.string()
|
|
10
|
+
.required('')
|
|
11
|
+
.test({
|
|
12
|
+
test: function (value) {
|
|
13
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
14
|
+
if (length === 0)
|
|
15
|
+
return true;
|
|
16
|
+
return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
|
|
17
|
+
}
|
|
18
|
+
}),
|
|
17
19
|
licenseType: yup.string().optional(),
|
|
18
|
-
entityType: yup.string().required('entity_type_required'),
|
|
20
|
+
entityType: noneEditable['type'] ? yup.string().optional() : yup.string().required('entity_type_required'),
|
|
19
21
|
licenseNumber: yup.string().optional(),
|
|
20
|
-
unifiedNumber:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
unifiedNumber: noneEditable['license.additional_info']
|
|
23
|
+
? yup.string().optional()
|
|
24
|
+
: yup.string().when('licenseType', function (licenseType) {
|
|
25
|
+
var isCR = licenseType === BusinessType.CR;
|
|
26
|
+
if (!isCR) {
|
|
27
|
+
return yup.string().optional();
|
|
28
|
+
}
|
|
29
|
+
return yup
|
|
30
|
+
.string()
|
|
31
|
+
.required('')
|
|
32
|
+
.test({
|
|
33
|
+
test: function (value) {
|
|
34
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
35
|
+
if (length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
36
|
+
return true;
|
|
37
|
+
if (length === 0)
|
|
38
|
+
return this.createError({ message: '' });
|
|
39
|
+
return this.createError({ message: 'unified_number_required' });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}),
|
|
43
|
+
issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
|
|
33
44
|
expiryDate: yup.string().optional(),
|
|
34
45
|
certificateId: yup.array().optional(),
|
|
35
46
|
articleId: yup.string().optional()
|
|
36
47
|
});
|
|
37
48
|
};
|
|
38
|
-
export var EntityNameKWValidationSchema = function () {
|
|
49
|
+
export var EntityNameKWValidationSchema = function (noneEditable) {
|
|
39
50
|
return yup.object().shape({
|
|
40
|
-
legalName:
|
|
41
|
-
.string()
|
|
42
|
-
|
|
43
|
-
.test({
|
|
44
|
-
test: function (value) {
|
|
45
|
-
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
46
|
-
if (length === 0)
|
|
47
|
-
return true;
|
|
48
|
-
return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
licenseType: yup.string().optional(),
|
|
52
|
-
entityType: yup.string().required('entity_type_required'),
|
|
53
|
-
licenseNumber: yup
|
|
54
|
-
.string()
|
|
55
|
-
.when('licenseType', function (licenseType) {
|
|
56
|
-
var isCR = licenseType === BusinessType.CR;
|
|
57
|
-
if (!isCR) {
|
|
58
|
-
return yup.string().optional();
|
|
59
|
-
}
|
|
60
|
-
return yup
|
|
51
|
+
legalName: noneEditable['legal_name.en'] && noneEditable['legal_name.ar']
|
|
52
|
+
? yup.string().optional()
|
|
53
|
+
: yup
|
|
61
54
|
.string()
|
|
62
55
|
.required('')
|
|
63
56
|
.test({
|
|
@@ -65,37 +58,44 @@ export var EntityNameKWValidationSchema = function () {
|
|
|
65
58
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
66
59
|
if (length === 0)
|
|
67
60
|
return true;
|
|
68
|
-
return length >=
|
|
61
|
+
return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
licenseType: yup.string().optional(),
|
|
65
|
+
entityType: noneEditable['type'] ? yup.string().optional() : yup.string().required('entity_type_required'),
|
|
66
|
+
licenseNumber: noneEditable['license.number']
|
|
67
|
+
? yup.string().optional()
|
|
68
|
+
: yup
|
|
69
|
+
.string()
|
|
70
|
+
.when('licenseType', function (licenseType) {
|
|
71
|
+
var isCR = licenseType === BusinessType.CR;
|
|
72
|
+
if (!isCR) {
|
|
73
|
+
return yup.string().optional();
|
|
69
74
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
return yup
|
|
76
|
+
.string()
|
|
77
|
+
.required('')
|
|
78
|
+
.test({
|
|
79
|
+
test: function (value) {
|
|
80
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
81
|
+
if (length === 0)
|
|
82
|
+
return true;
|
|
83
|
+
return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
})
|
|
87
|
+
.required(''),
|
|
88
|
+
issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
|
|
89
|
+
expiryDate: noneEditable['license.expiry_date'] ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
|
|
75
90
|
certificateId: yup.array().optional(),
|
|
76
91
|
articleId: yup.string().optional()
|
|
77
92
|
});
|
|
78
93
|
};
|
|
79
|
-
export var EntityNameOtherCountryValidationSchema = function () {
|
|
94
|
+
export var EntityNameOtherCountryValidationSchema = function (noneEditable) {
|
|
80
95
|
return yup.object().shape({
|
|
81
|
-
legalName:
|
|
82
|
-
.string()
|
|
83
|
-
|
|
84
|
-
.test({
|
|
85
|
-
test: function (value) {
|
|
86
|
-
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
87
|
-
if (length === 0)
|
|
88
|
-
return true;
|
|
89
|
-
return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
|
|
90
|
-
}
|
|
91
|
-
}),
|
|
92
|
-
licenseType: yup.string().optional(),
|
|
93
|
-
entityType: yup.string().required('entity_type_required'),
|
|
94
|
-
licenseNumber: yup
|
|
95
|
-
.string()
|
|
96
|
-
.when('licenseType', function (licenseType) {
|
|
97
|
-
var isCR = licenseType === BusinessType.CR;
|
|
98
|
-
return yup
|
|
96
|
+
legalName: noneEditable['legal_name.en'] && noneEditable['legal_name.ar']
|
|
97
|
+
? yup.string().optional()
|
|
98
|
+
: yup
|
|
99
99
|
.string()
|
|
100
100
|
.required('')
|
|
101
101
|
.test({
|
|
@@ -103,13 +103,32 @@ export var EntityNameOtherCountryValidationSchema = function () {
|
|
|
103
103
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
104
104
|
if (length === 0)
|
|
105
105
|
return true;
|
|
106
|
-
return length >=
|
|
106
|
+
return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
|
|
107
107
|
}
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
}),
|
|
109
|
+
licenseType: yup.string().optional(),
|
|
110
|
+
entityType: noneEditable['type'] ? yup.string().optional() : yup.string().required('entity_type_required'),
|
|
111
|
+
licenseNumber: noneEditable['license.number']
|
|
112
|
+
? yup.string().optional()
|
|
113
|
+
: yup
|
|
114
|
+
.string()
|
|
115
|
+
.when('licenseType', function (licenseType) {
|
|
116
|
+
var isCR = licenseType === BusinessType.CR;
|
|
117
|
+
return yup
|
|
118
|
+
.string()
|
|
119
|
+
.required('')
|
|
120
|
+
.test({
|
|
121
|
+
test: function (value) {
|
|
122
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
123
|
+
if (length === 0)
|
|
124
|
+
return true;
|
|
125
|
+
return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: isCR ? 'cr_kw_max_length' : 'fl_max_length' });
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
})
|
|
129
|
+
.required(''),
|
|
130
|
+
issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
|
|
131
|
+
expiryDate: noneEditable['license.expiry_date'] ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
|
|
113
132
|
certificateId: yup.array().optional(),
|
|
114
133
|
articleId: yup.string().optional()
|
|
115
134
|
});
|