@tap-payments/auth-jsconnect 2.13.3-beta → 2.13.5-beta

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
- export declare const EntityNameValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
- licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
16
- licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
16
+ entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
26
- licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
26
+ entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
37
- licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
38
- issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
39
- expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
46
- licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
47
- issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
48
- expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
55
- licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
56
- issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
57
- expiryDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: 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>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: 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>;
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: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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: 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>;
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,78 +1,56 @@
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, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
4
- export var EntityNameValidationSchema = function () {
3
+ import { KW_MIN_LICENSE_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
4
+ export var EntityNameValidationSchema = function (noneEditable) {
5
5
  return yup.object().shape({
6
- legalName: yup
7
- .string()
8
- .required('')
9
- .test({
10
- test: function (value) {
11
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
12
- if (length === 0)
13
- return true;
14
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
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'),
19
- licenseNumber: yup
20
- .string()
21
- .test({
22
- test: function (value) {
23
- var type = this.parent.licenseType;
24
- var isCR = type === BusinessType.CR;
25
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
26
- if (length === 0)
27
- return true;
28
- if (isCR) {
29
- return length >= CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
20
+ entityType: noneEditable['type'] ? yup.string().optional() : yup.string().required('entity_type_required'),
21
+ licenseNumber: yup.string().optional(),
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();
30
28
  }
31
- return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
32
- }
33
- })
34
- .required(''),
35
- unifiedNumber: yup.string().test({
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
- }),
47
- issuingDate: yup.string().required('choose_any_issuing_date'),
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'),
48
44
  expiryDate: yup.string().optional(),
49
45
  certificateId: yup.array().optional(),
50
46
  articleId: yup.string().optional()
51
47
  });
52
48
  };
53
- export var EntityNameKWValidationSchema = function () {
49
+ export var EntityNameKWValidationSchema = function (noneEditable) {
54
50
  return yup.object().shape({
55
- legalName: yup
56
- .string()
57
- .required('')
58
- .test({
59
- test: function (value) {
60
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
61
- if (length === 0)
62
- return true;
63
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
64
- }
65
- }),
66
- licenseType: yup.string().optional(),
67
- entityType: yup.string().required('entity_type_required'),
68
- licenseNumber: yup
69
- .string()
70
- .when('licenseType', function (licenseType) {
71
- var isCR = licenseType === BusinessType.CR;
72
- if (!isCR) {
73
- return yup.string().optional();
74
- }
75
- return yup
51
+ legalName: noneEditable['legal_name.en'] && noneEditable['legal_name.ar']
52
+ ? yup.string().optional()
53
+ : yup
76
54
  .string()
77
55
  .required('')
78
56
  .test({
@@ -80,37 +58,44 @@ export var EntityNameKWValidationSchema = function () {
80
58
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
81
59
  if (length === 0)
82
60
  return true;
83
- return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_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();
84
74
  }
85
- });
86
- })
87
- .required(''),
88
- issuingDate: yup.string().required('choose_any_issuing_date'),
89
- expiryDate: yup.string().required('choose_any_expiry_date'),
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'),
90
90
  certificateId: yup.array().optional(),
91
91
  articleId: yup.string().optional()
92
92
  });
93
93
  };
94
- export var EntityNameOtherCountryValidationSchema = function () {
94
+ export var EntityNameOtherCountryValidationSchema = function (noneEditable) {
95
95
  return yup.object().shape({
96
- legalName: yup
97
- .string()
98
- .required('')
99
- .test({
100
- test: function (value) {
101
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
102
- if (length === 0)
103
- return true;
104
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
105
- }
106
- }),
107
- licenseType: yup.string().optional(),
108
- entityType: yup.string().required('entity_type_required'),
109
- licenseNumber: yup
110
- .string()
111
- .when('licenseType', function (licenseType) {
112
- var isCR = licenseType === BusinessType.CR;
113
- return yup
96
+ legalName: noneEditable['legal_name.en'] && noneEditable['legal_name.ar']
97
+ ? yup.string().optional()
98
+ : yup
114
99
  .string()
115
100
  .required('')
116
101
  .test({
@@ -118,13 +103,32 @@ export var EntityNameOtherCountryValidationSchema = function () {
118
103
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
119
104
  if (length === 0)
120
105
  return true;
121
- return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: isCR ? 'cr_kw_max_length' : 'fl_max_length' });
106
+ return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
122
107
  }
123
- });
124
- })
125
- .required(''),
126
- issuingDate: yup.string().required('choose_any_issuing_date'),
127
- expiryDate: yup.string().required('choose_any_expiry_date'),
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'),
128
132
  certificateId: yup.array().optional(),
129
133
  articleId: yup.string().optional()
130
134
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.13.3-beta",
3
+ "version": "2.13.5-beta",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",