@tap-payments/auth-jsconnect 2.3.27-test → 2.3.28-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/build/api/entity.d.ts +5 -5
  2. package/build/features/app/bank/bankStore.js +26 -30
  3. package/build/features/app/brand/brandStore.js +38 -37
  4. package/build/features/app/entity/entityStore.js +58 -68
  5. package/build/features/app/individual/individualStore.js +59 -65
  6. package/build/features/app/tax/taxStore.js +23 -22
  7. package/build/features/bank/screens/BankDetails/BankDetails.js +4 -3
  8. package/build/features/bank/screens/BankDetails/validation.d.ts +14 -14
  9. package/build/features/bank/screens/BankDetails/validation.js +16 -21
  10. package/build/features/brand/screens/BrandActivities/BrandActivities.js +1 -2
  11. package/build/features/brand/screens/BrandActivities/validation.d.ts +7 -7
  12. package/build/features/brand/screens/BrandActivities/validation.js +10 -19
  13. package/build/features/brand/screens/BrandInfo/validation.d.ts +6 -9
  14. package/build/features/brand/screens/BrandInfo/validation.js +31 -38
  15. package/build/features/entity/screens/EntityCapital/EntityCapital.js +1 -1
  16. package/build/features/entity/screens/EntityCapital/validation.d.ts +10 -10
  17. package/build/features/entity/screens/EntityCapital/validation.js +4 -10
  18. package/build/features/entity/screens/EntityName/EntityName.js +1 -1
  19. package/build/features/entity/screens/EntityName/validation.d.ts +35 -35
  20. package/build/features/entity/screens/EntityName/validation.js +68 -93
  21. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
  22. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +2 -2
  23. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +6 -11
  24. package/build/features/tax/screens/TaxDetails/TaxDetails.js +1 -1
  25. package/build/features/tax/screens/TaxDetails/VATId.js +1 -1
  26. package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
  27. package/build/features/tax/screens/TaxDetails/validation.js +2 -5
  28. package/build/hooks/index.d.ts +1 -0
  29. package/build/hooks/index.js +1 -0
  30. package/build/hooks/useFormErrorAndUpdateReadOnly.d.ts +6 -0
  31. package/build/hooks/useFormErrorAndUpdateReadOnly.js +48 -0
  32. package/build/hooks/useFormReadOnly.js +4 -2
  33. package/package.json +1 -1
@@ -70,46 +70,39 @@ var validationSalesChannels = function (channels) {
70
70
  return true;
71
71
  };
72
72
  export var BrandValidationSchema = function () {
73
- var isNameOptional = false;
74
- var isSalesChannelsOptional = false;
75
73
  return yup.object().shape({
76
- brandName: isNameOptional
77
- ? yup.string().optional()
78
- : yup
79
- .string()
80
- .test({
81
- test: function (value) {
82
- if ((value === null || value === void 0 ? void 0 : value.length) === 0)
83
- return true;
84
- if (value && value.length >= 3)
85
- return true;
86
- return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
87
- }
88
- })
89
- .required('enter_brand_name_english_chars_numbers_space'),
90
- brandLogoId: yup.string().optional(),
74
+ brandName: yup
75
+ .string()
76
+ .test({
77
+ test: function (value) {
78
+ if ((value === null || value === void 0 ? void 0 : value.length) === 0)
79
+ return true;
80
+ if (value && value.length >= 3)
81
+ return true;
82
+ return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
83
+ }
84
+ })
85
+ .required('enter_brand_name_english_chars_numbers_space'),
91
86
  segment: yup.object().required('alert_choose_segment'),
92
87
  teamSize: yup.object().required('alert_choose_teamSize'),
93
- salesChannels: isSalesChannelsOptional
94
- ? yup.array().optional()
95
- : yup
96
- .array()
97
- .min(1, 'choose_atleast_one_channel')
98
- .of(yup.object().shape({
99
- id: yup.string().required('choose_atleast_one_channel')
100
- }))
101
- .test({
102
- test: function (value) {
103
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
104
- if (length === 0)
105
- return true;
106
- var channels = __spreadArray([], (value || []), true);
107
- var result = validationSalesChannels(channels);
108
- if (result === true)
109
- return true;
110
- return this.createError({ message: result });
111
- }
112
- })
113
- .required('choose_atleast_one_channel')
88
+ salesChannels: yup
89
+ .array()
90
+ .min(1, 'choose_atleast_one_channel')
91
+ .of(yup.object().shape({
92
+ id: yup.string().required('choose_atleast_one_channel')
93
+ }))
94
+ .test({
95
+ test: function (value) {
96
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
97
+ if (length === 0)
98
+ return true;
99
+ var channels = __spreadArray([], (value || []), true);
100
+ var result = validationSalesChannels(channels);
101
+ if (result === true)
102
+ return true;
103
+ return this.createError({ message: result });
104
+ }
105
+ })
106
+ .required('choose_atleast_one_channel')
114
107
  });
115
108
  };
@@ -53,7 +53,7 @@ var EntityCapital = function (_a) {
53
53
  var _d = data.entityCapitalData, responseBody = _d.responseBody, defaultValues = __rest(_d, ["responseBody"]);
54
54
  var entity = (data.verify.responseBody || {}).entity;
55
55
  var methods = useForm({
56
- resolver: yupResolver(EntityCapitalValidationSchema(entity)),
56
+ resolver: yupResolver(EntityCapitalValidationSchema()),
57
57
  defaultValues: defaultValues,
58
58
  mode: 'onChange'
59
59
  });
@@ -1,5 +1,5 @@
1
1
  import * as yup from 'yup';
2
- export declare const EntityCapitalValidationSchema: (entity: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
2
+ export declare const EntityCapitalValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
3
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
4
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
5
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -16,9 +16,9 @@ export declare const EntityCapitalValidationSchema: (entity: any) => yup.ObjectS
16
16
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
17
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
18
18
  }>>[] | undefined>;
19
- capitalPaid: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
20
- capitalShareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
- capitalShareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
19
+ capitalPaid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
20
+ capitalShareCount: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ capitalShareValue: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
22
22
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
23
23
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
24
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -36,9 +36,9 @@ export declare const EntityCapitalValidationSchema: (entity: any) => yup.ObjectS
36
36
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
37
37
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
38
38
  }>>[] | undefined>;
39
- capitalPaid: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
40
- capitalShareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
41
- capitalShareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
39
+ capitalPaid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
40
+ capitalShareCount: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
41
+ capitalShareValue: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
42
42
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
43
43
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
44
44
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -56,7 +56,7 @@ export declare const EntityCapitalValidationSchema: (entity: any) => yup.ObjectS
56
56
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
57
57
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
58
58
  }>>[] | undefined>;
59
- capitalPaid: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
60
- capitalShareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
61
- capitalShareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
59
+ capitalPaid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
60
+ capitalShareCount: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
61
+ capitalShareValue: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
62
62
  }>>>;
@@ -1,11 +1,5 @@
1
1
  import * as yup from 'yup';
2
- import { FieldType } from '../../../../@types';
3
- export var EntityCapitalValidationSchema = function (entity) {
4
- var _a, _b, _c, _d, _e;
5
- var _f = entity || {}, capital = _f.capital, data_status = _f.data_status;
6
- var isCapitalPaidOptional = !(capital === null || capital === void 0 ? void 0 : capital.paid) && ((_a = data_status === null || data_status === void 0 ? void 0 : data_status.capital) === null || _a === void 0 ? void 0 : _a.paid) === FieldType.NON_EDITABLE;
7
- var isCapitalShareCountOptional = !((_b = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _b === void 0 ? void 0 : _b.count) && ((_c = data_status === null || data_status === void 0 ? void 0 : data_status.capital) === null || _c === void 0 ? void 0 : _c.shares) === FieldType.NON_EDITABLE;
8
- var isCapitalShareValueOptional = !((_d = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _d === void 0 ? void 0 : _d.value) && ((_e = data_status === null || data_status === void 0 ? void 0 : data_status.capital) === null || _e === void 0 ? void 0 : _e.shares) === FieldType.NON_EDITABLE;
2
+ export var EntityCapitalValidationSchema = function () {
9
3
  return yup.object().shape({
10
4
  activities: yup
11
5
  .array()
@@ -14,8 +8,8 @@ export var EntityCapitalValidationSchema = function (entity) {
14
8
  ar: yup.string(),
15
9
  en: yup.string()
16
10
  })),
17
- capitalPaid: isCapitalPaidOptional ? yup.string().optional() : yup.string().required('capital_paid_required'),
18
- capitalShareCount: isCapitalShareCountOptional ? yup.string().optional() : yup.string().required('capital_share_count_required'),
19
- capitalShareValue: isCapitalShareValueOptional ? yup.string().optional() : yup.string().required('capital_share_value_required')
11
+ capitalPaid: yup.string().required('capital_paid_required'),
12
+ capitalShareCount: yup.string().required('capital_share_count_required'),
13
+ capitalShareValue: yup.string().required('capital_share_value_required')
20
14
  });
21
15
  };
@@ -53,7 +53,7 @@ var EntityName = function (_a) {
53
53
  var isCR = licenseType === BusinessType.CR;
54
54
  var entity = (data.verify.responseBody || {}).entity;
55
55
  var methods = useForm({
56
- resolver: yupResolver(isSACountry ? EntityNameValidationSchema(entity) : EntityNameKWValidationSchema(entity)),
56
+ resolver: yupResolver(isSACountry ? EntityNameValidationSchema() : EntityNameKWValidationSchema()),
57
57
  defaultValues: {
58
58
  legalName: legalName,
59
59
  licenseNumber: licenseNumber,
@@ -1,60 +1,60 @@
1
1
  import * as yup from 'yup';
2
- export declare const EntityNameValidationSchema: (entity: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
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>;
4
4
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
- entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
6
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
7
- unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
8
- issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
- expiryDate: 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>;
7
+ unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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, {
13
- legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
13
+ legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
14
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
15
- entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
16
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
- unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
18
- issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
19
- expiryDate: 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>;
17
+ unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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, {
23
- legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
+ legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
24
24
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
25
- entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
26
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
27
- unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
28
- issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
29
- expiryDate: 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>;
27
+ unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
28
+ issuingDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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
  }>>>;
33
- export declare const EntityNameKWValidationSchema: (entity: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
34
- legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
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>;
35
35
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
36
- entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
37
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
38
- issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
39
- expiryDate: 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>;
40
40
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
41
41
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
42
42
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
43
- legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
43
+ legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
44
44
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
45
- entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
46
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
47
- issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
48
- expiryDate: 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>;
49
49
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
50
50
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
51
51
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
52
- legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
52
+ legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
53
53
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
54
- entityType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
55
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
56
- issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
57
- expiryDate: 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>;
58
58
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
59
59
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
60
60
  }>>>;
@@ -1,79 +1,76 @@
1
1
  import * as yup from 'yup';
2
- import { BusinessType, FieldType } from '../../../../@types';
2
+ import { BusinessType } from '../../../../@types';
3
3
  import { KW_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH } from '../../../../constants';
4
- export var EntityNameValidationSchema = function (entity) {
5
- var _a, _b, _c, _d, _e;
6
- var _f = entity || {}, legal_name = _f.legal_name, data_status = _f.data_status, license = _f.license;
7
- var isLegalNameOptional = !((legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar) || (legal_name === null || legal_name === void 0 ? void 0 : legal_name.en)) && (data_status === null || data_status === void 0 ? void 0 : data_status.legal_name) === FieldType.NON_EDITABLE;
8
- var isEntityTypeOptional = !(license === null || license === void 0 ? void 0 : license.type) && (data_status === null || data_status === void 0 ? void 0 : data_status.type) === FieldType.NON_EDITABLE;
9
- var isLicenseNumberOptional = !(license === null || license === void 0 ? void 0 : license.number) && ((_a = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _a === void 0 ? void 0 : _a.number) === FieldType.NON_EDITABLE;
10
- var isUnifiedNumberOptional = !((_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) && ((_c = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _c === void 0 ? void 0 : _c.additional_info) === FieldType.NON_EDITABLE;
11
- var isIssuingDateOptional = !(license === null || license === void 0 ? void 0 : license.issuing_date) && ((_d = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _d === void 0 ? void 0 : _d.issuing_date) === FieldType.NON_EDITABLE;
12
- var isExpiryDateOptional = !(license === null || license === void 0 ? void 0 : license.expiry_date) && ((_e = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _e === void 0 ? void 0 : _e.expiry_date) === FieldType.NON_EDITABLE;
4
+ export var EntityNameValidationSchema = function () {
13
5
  return yup.object().shape({
14
- legalName: isLegalNameOptional
15
- ? yup.string().optional()
16
- : yup
17
- .string()
18
- .required('')
19
- .test({
20
- test: function (value) {
21
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
22
- if (length === 0)
23
- return true;
24
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
25
- }
26
- }),
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
+ }),
27
17
  licenseType: yup.string().optional(),
28
- entityType: isEntityTypeOptional ? yup.string().optional() : yup.string().required('entity_type_required'),
29
- licenseNumber: isLicenseNumberOptional
30
- ? yup.string().optional()
31
- : yup
32
- .string()
33
- .test({
34
- test: function (value) {
35
- var type = this.parent.licenseType;
36
- var isCR = type === BusinessType.CR;
37
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
38
- if (length === 0)
39
- return true;
40
- if (isCR) {
41
- return length > CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
42
- }
43
- return length > FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
44
- }
45
- })
46
- .required(''),
47
- unifiedNumber: isUnifiedNumberOptional
48
- ? yup.string().optional()
49
- : yup
50
- .string()
51
- .when('licenseType', function (licenseType) {
52
- var isCR = licenseType === BusinessType.CR;
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;
53
28
  if (isCR) {
54
- return yup.string().required('unified_number_required');
29
+ return length > CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
55
30
  }
56
- return yup.string().optional();
57
- })
58
- .required(''),
59
- issuingDate: isIssuingDateOptional ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
60
- expiryDate: isExpiryDateOptional ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
31
+ return length > FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
32
+ }
33
+ })
34
+ .required(''),
35
+ unifiedNumber: yup
36
+ .string()
37
+ .when('licenseType', function (licenseType) {
38
+ var isCR = licenseType === BusinessType.CR;
39
+ if (isCR) {
40
+ return yup.string().required('unified_number_required');
41
+ }
42
+ return yup.string().optional();
43
+ })
44
+ .required(''),
45
+ issuingDate: yup.string().required('choose_any_issuing_date'),
46
+ expiryDate: yup.string().required('choose_any_expiry_date'),
61
47
  certificateId: yup.array().optional(),
62
48
  articleId: yup.string().optional()
63
49
  });
64
50
  };
65
- export var EntityNameKWValidationSchema = function (entity) {
66
- var _a, _b, _c;
67
- var _d = entity || {}, legal_name = _d.legal_name, data_status = _d.data_status, license = _d.license;
68
- var isLegalNameOptional = !((legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar) || (legal_name === null || legal_name === void 0 ? void 0 : legal_name.en)) && (data_status === null || data_status === void 0 ? void 0 : data_status.legal_name) === FieldType.NON_EDITABLE;
69
- var isEntityTypeOptional = !(license === null || license === void 0 ? void 0 : license.type) && (data_status === null || data_status === void 0 ? void 0 : data_status.type) === FieldType.NON_EDITABLE;
70
- var isLicenseNumberOptional = !(license === null || license === void 0 ? void 0 : license.number) && ((_a = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _a === void 0 ? void 0 : _a.number) === FieldType.NON_EDITABLE;
71
- var isIssuingDateOptional = !(license === null || license === void 0 ? void 0 : license.issuing_date) && ((_b = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _b === void 0 ? void 0 : _b.issuing_date) === FieldType.NON_EDITABLE;
72
- var isExpiryDateOptional = !(license === null || license === void 0 ? void 0 : license.expiry_date) && ((_c = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _c === void 0 ? void 0 : _c.expiry_date) === FieldType.NON_EDITABLE;
51
+ export var EntityNameKWValidationSchema = function () {
73
52
  return yup.object().shape({
74
- legalName: isLegalNameOptional
75
- ? yup.string().optional()
76
- : yup
53
+ legalName: yup
54
+ .string()
55
+ .required('')
56
+ .test({
57
+ test: function (value) {
58
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
59
+ if (length === 0)
60
+ return true;
61
+ return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
62
+ }
63
+ }),
64
+ licenseType: yup.string().optional(),
65
+ entityType: yup.string().required('entity_type_required'),
66
+ licenseNumber: yup
67
+ .string()
68
+ .when('licenseType', function (licenseType) {
69
+ var isCR = licenseType === BusinessType.CR;
70
+ if (!isCR) {
71
+ return yup.string().optional();
72
+ }
73
+ return yup
77
74
  .string()
78
75
  .required('')
79
76
  .test({
@@ -81,35 +78,13 @@ export var EntityNameKWValidationSchema = function (entity) {
81
78
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
82
79
  if (length === 0)
83
80
  return true;
84
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
85
- }
86
- }),
87
- licenseType: yup.string().optional(),
88
- entityType: isEntityTypeOptional ? yup.string().optional() : yup.string().required('entity_type_required'),
89
- licenseNumber: isLicenseNumberOptional
90
- ? yup.string().optional()
91
- : yup
92
- .string()
93
- .when('licenseType', function (licenseType) {
94
- var isCR = licenseType === BusinessType.CR;
95
- if (!isCR) {
96
- return yup.string().optional();
81
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
97
82
  }
98
- return yup
99
- .string()
100
- .required('')
101
- .test({
102
- test: function (value) {
103
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
104
- if (length === 0)
105
- return true;
106
- return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
107
- }
108
- });
109
- })
110
- .required(''),
111
- issuingDate: isIssuingDateOptional ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
112
- expiryDate: isExpiryDateOptional ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
83
+ });
84
+ })
85
+ .required(''),
86
+ issuingDate: yup.string().required('choose_any_issuing_date'),
87
+ expiryDate: yup.string().required('choose_any_expiry_date'),
113
88
  certificateId: yup.array().optional(),
114
89
  articleId: yup.string().optional()
115
90
  });
@@ -63,7 +63,7 @@ var AdditionalIndividualInfo = function (_a) {
63
63
  var isAuthorizedUser = user === null || user === void 0 ? void 0 : user.is_authorized;
64
64
  var _c = data.individualData, occupation = _c.occupation, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, employerName = _c.employerName, employerLocation = _c.employerLocation, isPEP = _c.isPEP, isInfluencer = _c.isInfluencer, civilID = _c.civilID, signatureFileId = _c.signatureFileId, civilIDUploading = _c.civilIDUploading, signatureFileUploading = _c.signatureFileUploading, shareCount = _c.shareCount, shareValue = _c.shareValue;
65
65
  var methods = useForm({
66
- resolver: yupResolver(IndividualInfoValidationSchema(isAuthorizedUser, user)),
66
+ resolver: yupResolver(IndividualInfoValidationSchema(user === null || user === void 0 ? void 0 : user.type)),
67
67
  defaultValues: {
68
68
  occupation: occupation,
69
69
  sourceIncome: sourceIncome,
@@ -1,6 +1,6 @@
1
1
  import * as yup from 'yup';
2
- import { User } from '../../../../@types';
3
- export declare const IndividualInfoValidationSchema: (isAuthorizedUser: boolean, user: User) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
2
+ import { IndividualType } from '../../../../@types';
3
+ export declare const IndividualInfoValidationSchema: (type: IndividualType) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
4
  occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
5
5
  sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
6
6
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
@@ -1,19 +1,14 @@
1
1
  import * as yup from 'yup';
2
- import { IndividualType, FieldType } from '../../../../@types';
3
- export var IndividualInfoValidationSchema = function (isAuthorizedUser, user) {
4
- var _a = user || {}, type = _a.type, data_status = _a.data_status, occupation = _a.occupation, source_income = _a.source_income, is_relative_PEP = _a.is_relative_PEP, is_influencer = _a.is_influencer;
5
- var isOccupationOptional = !occupation && (data_status === null || data_status === void 0 ? void 0 : data_status.occupation) === FieldType.NON_EDITABLE;
6
- var isSourceIncomeOptional = !source_income && (data_status === null || data_status === void 0 ? void 0 : data_status.source_of_income) === FieldType.NON_EDITABLE;
7
- var isPEPOptional = is_relative_PEP === undefined && (data_status === null || data_status === void 0 ? void 0 : data_status.is_relative_PEP) === FieldType.NON_EDITABLE;
8
- var isInfluencerOptional = is_influencer === undefined && (data_status === null || data_status === void 0 ? void 0 : data_status.is_influencer) === FieldType.NON_EDITABLE;
2
+ import { IndividualType } from '../../../../@types';
3
+ export var IndividualInfoValidationSchema = function (type) {
9
4
  return yup.object().shape({
10
- occupation: type === IndividualType.USER && !isOccupationOptional ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
11
- sourceIncome: type === IndividualType.USER && !isSourceIncomeOptional ? yup.object().required('choose_any_source_of_income') : yup.object().optional(),
5
+ occupation: type === IndividualType.USER ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
6
+ sourceIncome: type === IndividualType.USER ? yup.object().required('choose_any_source_of_income') : yup.object().optional(),
12
7
  monthlyIncome: yup.object().optional(),
13
8
  civilID: yup.array().optional(),
14
9
  signatureFileId: yup.array().optional(),
15
- isPEP: type === IndividualType.USER && !isPEPOptional ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional(),
16
- isInfluencer: type === IndividualType.USER && !isInfluencerOptional ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional(),
10
+ isPEP: type === IndividualType.USER ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional(),
11
+ isInfluencer: type === IndividualType.USER ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional(),
17
12
  shareCount: yup.string().optional(),
18
13
  shareValue: yup.string().optional()
19
14
  });
@@ -40,7 +40,7 @@ var TaxDetails = function () {
40
40
  var settingsData = useAppSelector(settingsSelector).data;
41
41
  var _b = data.taxData, vatId = _b.vatId, confirmPolicy = _b.confirmPolicy, documentId = _b.documentId;
42
42
  var methods = useForm({
43
- resolver: yupResolver(Validation(entity)),
43
+ resolver: yupResolver(Validation()),
44
44
  defaultValues: {
45
45
  vatId: vatId,
46
46
  confirmPolicy: confirmPolicy,
@@ -39,6 +39,6 @@ var VATId = function (_a) {
39
39
  var clearValue = function () {
40
40
  vatControl.field.onChange('');
41
41
  };
42
- return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { readOnly: readOnly, label: t('vat_id'), disabled: disabled, inputProps: { maxLength: VAT_ID_LENGTH }, value: vatValue, onChange: function (event) { return handleOnChange(event.target.value); }, placeholder: t('vat_id_placeholder'), warningType: 'alert', warningMessage: vatError && t(vatError), required: true, endAdornment: !vatError && vatValue ? _jsx(CheckIcon, {}) : vatValue && _jsx(ClearIcon, { onClick: clearValue }) }) })));
42
+ return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { readOnly: readOnly, label: t('vat_id'), disabled: disabled, inputProps: { maxLength: VAT_ID_LENGTH }, value: vatValue || '', onChange: function (event) { return handleOnChange(event.target.value); }, placeholder: t('vat_id_placeholder'), warningType: 'alert', warningMessage: vatError && t(vatError), required: true, endAdornment: !vatError && vatValue ? _jsx(CheckIcon, {}) : vatValue && _jsx(ClearIcon, { onClick: clearValue }) }) })));
43
43
  };
44
44
  export default VATId;
@@ -1,14 +1,14 @@
1
1
  import * as yup from 'yup';
2
- export declare const Validation: (entity: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- vatId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
2
+ export declare const Validation: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
4
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
5
5
  documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
6
6
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
- vatId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
7
+ vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
8
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
9
9
  documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
10
10
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
- vatId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
11
+ vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
12
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
13
13
  documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
14
14
  }>>>;
@@ -1,10 +1,7 @@
1
1
  import * as yup from 'yup';
2
- import { FieldType } from '../../../../@types';
3
- export var Validation = function (entity) {
4
- var _a = entity || {}, vat_id = _a.vat_id, data_status = _a.data_status;
5
- var isTaxNumberOptional = !vat_id && (data_status === null || data_status === void 0 ? void 0 : data_status.tax_number) === FieldType.NON_EDITABLE;
2
+ export var Validation = function () {
6
3
  return yup.object().shape({
7
- vatId: isTaxNumberOptional ? yup.string().optional() : yup.string().min(9, 'alert_vat').max(15, 'alert_vat').required('alert_vat'),
4
+ vatId: yup.string().min(9, 'alert_vat').max(15, 'alert_vat').required('alert_vat'),
8
5
  confirmPolicy: yup.boolean().required('alert_tax_confirm').isTrue('alert_tax_confirm'),
9
6
  documentId: yup.array().optional()
10
7
  });
@@ -17,3 +17,4 @@ export * from './useCountry';
17
17
  export * from './useVerifyToken';
18
18
  export * from './useFormReadOnly';
19
19
  export * from './useDataNoneEditable';
20
+ export * from './useFormErrorAndUpdateReadOnly';
@@ -17,3 +17,4 @@ export * from './useCountry';
17
17
  export * from './useVerifyToken';
18
18
  export * from './useFormReadOnly';
19
19
  export * from './useDataNoneEditable';
20
+ export * from './useFormErrorAndUpdateReadOnly';
@@ -0,0 +1,6 @@
1
+ import { FieldValues, UseFormReturn } from 'react-hook-form';
2
+ declare type ReadOnly<TF, V> = {
3
+ [key in keyof TF]: V;
4
+ };
5
+ export declare const useFormErrorAndUpdateReadOnly: <TF extends FieldValues = FieldValues>(methods: UseFormReturn<TF, any>, readOnlyData: { [key in keyof TF]: boolean; }, noneEditable?: Record<any, boolean>) => ReadOnly<TF, boolean>;
6
+ export {};