@tap-payments/auth-jsconnect 2.10.7-development → 2.10.7

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 (179) hide show
  1. package/README.md +2 -2
  2. package/build/@types/app.d.ts +2 -2
  3. package/build/@types/app.js +0 -1
  4. package/build/@types/form.d.ts +2 -0
  5. package/build/@types/index.d.ts +0 -1
  6. package/build/@types/index.js +0 -1
  7. package/build/api/auth.d.ts +1 -9
  8. package/build/api/axios.d.ts +1 -1
  9. package/build/api/entity.d.ts +3 -0
  10. package/build/api/index.d.ts +1 -7
  11. package/build/api/index.js +1 -3
  12. package/build/api/lead.d.ts +1 -0
  13. package/build/app/rootReducer.d.ts +0 -1
  14. package/build/app/rootReducer.js +1 -3
  15. package/build/app/settings.js +1 -2
  16. package/build/app/store.d.ts +0 -2
  17. package/build/assets/currencies/AEDSymbol.d.ts +7 -0
  18. package/build/assets/currencies/AEDSymbol.js +28 -0
  19. package/build/assets/currencies/SARSymbol.js +1 -1
  20. package/build/assets/currencies/index.d.ts +2 -2
  21. package/build/assets/currencies/index.js +2 -2
  22. package/build/assets/currencies/utils.js +3 -1
  23. package/build/assets/locales/ar.json +13 -5
  24. package/build/assets/locales/en.json +14 -5
  25. package/build/components/OTPTimer/OTPTimer.d.ts +1 -2
  26. package/build/components/OTPTimer/OTPTimer.js +4 -4
  27. package/build/components/TextWithCurrency/TextWithCurrency.js +1 -1
  28. package/build/components/Tooltip/Tooltip.js +1 -1
  29. package/build/constants/api.d.ts +2 -0
  30. package/build/constants/api.js +4 -0
  31. package/build/constants/app.d.ts +12 -12
  32. package/build/constants/app.js +8 -119
  33. package/build/constants/assets.d.ts +4 -6
  34. package/build/constants/assets.js +118 -114
  35. package/build/constants/dummy.js +27 -20
  36. package/build/constants/flows.d.ts +0 -15
  37. package/build/constants/flows.js +0 -15
  38. package/build/constants/validation.d.ts +1 -1
  39. package/build/constants/validation.js +1 -1
  40. package/build/features/app/business/businessStore.js +15 -10
  41. package/build/features/app/connectExpress/connectExpressStore.js +19 -4
  42. package/build/features/app/individual/individualStore.js +1 -0
  43. package/build/features/auth/Auth.d.ts +1 -1
  44. package/build/features/auth/screens/AuthenticationList/EntityList.js +2 -2
  45. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
  46. package/build/features/business/screens/BusinessType/BusinessType.js +13 -2
  47. package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
  48. package/build/features/business/screens/BusinessType/LicenseList.js +15 -7
  49. package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
  50. package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
  51. package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
  52. package/build/features/business/screens/BusinessType/validation.js +31 -10
  53. package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
  54. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +2 -2
  55. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
  56. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +23 -7
  57. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
  58. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
  59. package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
  60. package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
  61. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
  62. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
  63. package/build/features/entity/screens/EntityName/EntityName.js +16 -15
  64. package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
  65. package/build/features/entity/screens/EntityName/validation.d.ts +50 -48
  66. package/build/features/entity/screens/EntityName/validation.js +100 -85
  67. package/build/features/featuresScreens.d.ts +0 -1
  68. package/build/features/featuresScreens.js +0 -67
  69. package/build/features/shared/Button/Button.js +1 -1
  70. package/build/features/shared/Button/FlowsButtons.js +2 -3
  71. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
  72. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +1 -3
  73. package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
  74. package/build/hooks/useAppConfig.js +1 -1
  75. package/build/hooks/useAppDispatch.d.ts +0 -1
  76. package/build/index.d.ts +2 -3
  77. package/build/index.js +2 -4
  78. package/build/theme/palette.js +0 -12
  79. package/build/theme/typography.js +0 -4
  80. package/build/utils/common.d.ts +1 -1
  81. package/build/utils/common.js +18 -8
  82. package/build/utils/string.d.ts +3 -2
  83. package/build/utils/string.js +5 -5
  84. package/build/utils/validation.js +1 -1
  85. package/package.json +3 -3
  86. package/build/@types/terminal.d.ts +0 -116
  87. package/build/@types/terminal.js +0 -1
  88. package/build/api/terminal.d.ts +0 -28
  89. package/build/api/terminal.js +0 -45
  90. package/build/components/DeviceCard/DeviceCard.d.ts +0 -18
  91. package/build/components/DeviceCard/DeviceCard.js +0 -103
  92. package/build/components/DeviceCard/index.d.ts +0 -3
  93. package/build/components/DeviceCard/index.js +0 -2
  94. package/build/features/app/terminal/terminalStore.d.ts +0 -109
  95. package/build/features/app/terminal/terminalStore.js +0 -676
  96. package/build/features/shared/PushNotification/PushNotification.d.ts +0 -11
  97. package/build/features/shared/PushNotification/PushNotification.js +0 -34
  98. package/build/features/shared/PushNotification/index.d.ts +0 -2
  99. package/build/features/shared/PushNotification/index.js +0 -2
  100. package/build/features/terminal/Terminal.d.ts +0 -14
  101. package/build/features/terminal/Terminal.js +0 -95
  102. package/build/features/terminal/index.d.ts +0 -1
  103. package/build/features/terminal/index.js +0 -1
  104. package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.d.ts +0 -3
  105. package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +0 -68
  106. package/build/features/terminal/screens/LinkNewTerminal/index.d.ts +0 -2
  107. package/build/features/terminal/screens/LinkNewTerminal/index.js +0 -2
  108. package/build/features/terminal/screens/LinkNewTerminal/styles.d.ts +0 -10
  109. package/build/features/terminal/screens/LinkNewTerminal/styles.js +0 -28
  110. package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.d.ts +0 -3
  111. package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +0 -51
  112. package/build/features/terminal/screens/LinkedSuccess/index.d.ts +0 -2
  113. package/build/features/terminal/screens/LinkedSuccess/index.js +0 -2
  114. package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.d.ts +0 -3
  115. package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +0 -50
  116. package/build/features/terminal/screens/LinkedTerminalInfo/index.d.ts +0 -2
  117. package/build/features/terminal/screens/LinkedTerminalInfo/index.js +0 -2
  118. package/build/features/terminal/screens/Loading/Loading.d.ts +0 -4
  119. package/build/features/terminal/screens/Loading/Loading.js +0 -10
  120. package/build/features/terminal/screens/Loading/index.d.ts +0 -2
  121. package/build/features/terminal/screens/Loading/index.js +0 -2
  122. package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.d.ts +0 -3
  123. package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +0 -56
  124. package/build/features/terminal/screens/NoTerminalDeviceLinked/index.d.ts +0 -2
  125. package/build/features/terminal/screens/NoTerminalDeviceLinked/index.js +0 -2
  126. package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.d.ts +0 -36
  127. package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.js +0 -34
  128. package/build/features/terminal/screens/OperatorError/OperatorError.d.ts +0 -5
  129. package/build/features/terminal/screens/OperatorError/OperatorError.js +0 -9
  130. package/build/features/terminal/screens/OperatorError/index.d.ts +0 -2
  131. package/build/features/terminal/screens/OperatorError/index.js +0 -2
  132. package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +0 -3
  133. package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +0 -21
  134. package/build/features/terminal/screens/ResetPasswordSuccess/index.d.ts +0 -2
  135. package/build/features/terminal/screens/ResetPasswordSuccess/index.js +0 -2
  136. package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +0 -3
  137. package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +0 -31
  138. package/build/features/terminal/screens/SuccessWithFlowButtons/index.d.ts +0 -2
  139. package/build/features/terminal/screens/SuccessWithFlowButtons/index.js +0 -2
  140. package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +0 -9
  141. package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +0 -20
  142. package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.d.ts +0 -3
  143. package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +0 -144
  144. package/build/features/terminal/screens/TerminalDeviceList/index.d.ts +0 -2
  145. package/build/features/terminal/screens/TerminalDeviceList/index.js +0 -2
  146. package/build/features/terminal/screens/TerminalDeviceList/styles.d.ts +0 -9
  147. package/build/features/terminal/screens/TerminalDeviceList/styles.js +0 -13
  148. package/build/features/terminal/screens/TerminalListPage/TerminalListPage.d.ts +0 -3
  149. package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +0 -42
  150. package/build/features/terminal/screens/TerminalListPage/index.d.ts +0 -2
  151. package/build/features/terminal/screens/TerminalListPage/index.js +0 -2
  152. package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.d.ts +0 -3
  153. package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +0 -53
  154. package/build/features/terminal/screens/UnlinkedSuccess/index.d.ts +0 -2
  155. package/build/features/terminal/screens/UnlinkedSuccess/index.js +0 -2
  156. package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.d.ts +0 -3
  157. package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +0 -98
  158. package/build/features/terminal/screens/UnlinkedTerminalInfo/index.d.ts +0 -2
  159. package/build/features/terminal/screens/UnlinkedTerminalInfo/index.js +0 -2
  160. package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.d.ts +0 -26
  161. package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.js +0 -30
  162. package/build/features/terminal/screens/Verify/OTPInput.d.ts +0 -7
  163. package/build/features/terminal/screens/Verify/OTPInput.js +0 -51
  164. package/build/features/terminal/screens/Verify/Verify.d.ts +0 -5
  165. package/build/features/terminal/screens/Verify/Verify.js +0 -85
  166. package/build/features/terminal/screens/Verify/index.d.ts +0 -2
  167. package/build/features/terminal/screens/Verify/index.js +0 -2
  168. package/build/features/terminal/screens/Verify/validation.d.ts +0 -8
  169. package/build/features/terminal/screens/Verify/validation.js +0 -4
  170. package/build/features/terminal/screens/shared/Header.d.ts +0 -10
  171. package/build/features/terminal/screens/shared/Header.js +0 -30
  172. package/build/features/terminal/screens/shared/TerminalList.d.ts +0 -11
  173. package/build/features/terminal/screens/shared/TerminalList.js +0 -25
  174. package/build/features/terminal/screens/shared/index.d.ts +0 -5
  175. package/build/features/terminal/screens/shared/index.js +0 -5
  176. package/build/features/terminal/screens/shared/styles.d.ts +0 -196
  177. package/build/features/terminal/screens/shared/styles.js +0 -155
  178. package/build/features/terminal/screens/shared/utils.d.ts +0 -7
  179. package/build/features/terminal/screens/shared/utils.js +0 -24
@@ -1,5 +1,5 @@
1
1
  import * as yup from 'yup';
2
- import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH, BRAND_NAME_MAX_LENGTH } from '../../../../constants';
2
+ import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH, BRAND_NAME_MAX_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
3
3
  import { BusinessType } from '../../../../@types';
4
4
  var objectElements = {
5
5
  legal_name: yup.object().shape({
@@ -7,7 +7,7 @@ var objectElements = {
7
7
  en: yup.string()
8
8
  }),
9
9
  license: yup.object().shape({
10
- number: yup.string()
10
+ number: yup.string().nullable()
11
11
  }),
12
12
  type: yup.string()
13
13
  };
@@ -94,22 +94,40 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
94
94
  })
95
95
  .required('enter_brand_name_english_chars_numbers_space'),
96
96
  selectedLicense: yup.object().shape(objectElements).required(''),
97
- licenseNumber: yup
98
- .string()
99
- .test({
97
+ unifiedNumber: yup.string().test({
98
+ name: 'unifiedNumber',
99
+ message: '',
100
100
  test: function (value) {
101
+ var _a;
101
102
  var selectedLicense = this.parent.selectedLicense;
102
- var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
103
+ var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
103
104
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
105
+ if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
106
+ return false;
107
+ if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
108
+ return true;
104
109
  if (length === 0)
110
+ return this.createError({ message: '' });
111
+ return this.createError({ message: 'unified_number_required' });
112
+ }
113
+ }),
114
+ licenseNumber: yup.string().test({
115
+ name: 'licenseNumber',
116
+ message: '',
117
+ test: function (value) {
118
+ var _a;
119
+ var selectedLicense = this.parent.selectedLicense;
120
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
121
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
122
+ if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
123
+ return false;
124
+ if (isCR || length >= FL_MIN_LICENSE_LENGTH)
105
125
  return true;
106
- if (isCR) {
107
- return length >= CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
108
- }
109
- return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
126
+ if (length === 0)
127
+ return this.createError({ message: '' });
128
+ return this.createError({ message: 'fl_max_length' });
110
129
  }
111
- })
112
- .required(''),
130
+ }),
113
131
  termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond')
114
132
  });
115
133
  }
@@ -127,22 +145,40 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
127
145
  })
128
146
  .required('enter_brand_name_english_chars_numbers_space'),
129
147
  selectedLicense: yup.object().shape(objectElements).required(''),
130
- licenseNumber: yup
131
- .string()
132
- .test({
148
+ unifiedNumber: yup.string().test({
149
+ name: 'unifiedNumber',
150
+ message: '',
133
151
  test: function (value) {
152
+ var _a;
134
153
  var selectedLicense = this.parent.selectedLicense;
135
- var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
154
+ var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
136
155
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
156
+ if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
157
+ return false;
158
+ if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
159
+ return true;
137
160
  if (length === 0)
161
+ return this.createError({ message: '' });
162
+ return this.createError({ message: 'unified_number_required' });
163
+ }
164
+ }),
165
+ licenseNumber: yup.string().test({
166
+ name: 'licenseNumber',
167
+ message: '',
168
+ test: function (value) {
169
+ var _a;
170
+ var selectedLicense = this.parent.selectedLicense;
171
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
172
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
173
+ if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
174
+ return false;
175
+ if (isCR || length >= FL_MIN_LICENSE_LENGTH)
138
176
  return true;
139
- if (isCR) {
140
- return length >= CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
141
- }
142
- return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
177
+ if (length === 0)
178
+ return this.createError({ message: '' });
179
+ return this.createError({ message: 'fl_max_length' });
143
180
  }
144
181
  })
145
- .required('')
146
182
  });
147
183
  };
148
184
  export var KWBusinessDataSchema = function (isLeadIdPassed) {
@@ -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, [
@@ -155,8 +155,9 @@ var EntityName = function (_a) {
155
155
  }, [methods.formState.isValid]);
156
156
  var disabled = !methods.formState.isValid || uploading || uploadingArticle;
157
157
  var showLicenseNumber = isKWCountry ? isCR : true;
158
+ var showExpiryDate = isSACountry ? !isCR : true;
158
159
  var showUnifiedNumber = isSACountry ? isCR : false;
159
160
  var disableBack = settingsData.appConfig.mode === 'content';
160
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified }), _jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: isSACountry ? false : !isKWCountry || isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: !isSACountry, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
161
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified }), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl && showExpiryDate }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: isSACountry ? false : !isKWCountry || isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: !isSACountry, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
161
162
  };
162
163
  export default EntityName;
@@ -14,7 +14,7 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
- import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
17
+ import { removeAllCharsFromNumber } from '../../../../utils';
18
18
  import Collapse from '../../../../components/Collapse';
19
19
  import { ScreenContainer } from '../../../shared/Containers';
20
20
  import Input from '../../../shared/Input';
@@ -31,7 +31,7 @@ var UnifiedNumber = function (_a) {
31
31
  var target = _a.target;
32
32
  if (bckError)
33
33
  dispatch(clearError());
34
- var value = removeAllOtherThanCharsAndNumber(target.value);
34
+ var value = removeAllCharsFromNumber(target.value);
35
35
  unifiedNumberControl.field.onChange(value);
36
36
  };
37
37
  var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
@@ -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
- expiryDate: 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>;
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
- expiryDate: 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>;
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
- expiryDate: 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>;
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,67 +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 } 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().optional(),
36
- issuingDate: yup.string().required('choose_any_issuing_date'),
37
- expiryDate: yup.string().required('choose_any_expiry_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'),
44
+ expiryDate: yup.string().optional(),
38
45
  certificateId: yup.array().optional(),
39
46
  articleId: yup.string().optional()
40
47
  });
41
48
  };
42
- export var EntityNameKWValidationSchema = function () {
49
+ export var EntityNameKWValidationSchema = function (noneEditable) {
43
50
  return yup.object().shape({
44
- legalName: yup
45
- .string()
46
- .required('')
47
- .test({
48
- test: function (value) {
49
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
50
- if (length === 0)
51
- return true;
52
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
53
- }
54
- }),
55
- licenseType: yup.string().optional(),
56
- entityType: yup.string().required('entity_type_required'),
57
- licenseNumber: yup
58
- .string()
59
- .when('licenseType', function (licenseType) {
60
- var isCR = licenseType === BusinessType.CR;
61
- if (!isCR) {
62
- return yup.string().optional();
63
- }
64
- return yup
51
+ legalName: noneEditable['legal_name.en'] && noneEditable['legal_name.ar']
52
+ ? yup.string().optional()
53
+ : yup
65
54
  .string()
66
55
  .required('')
67
56
  .test({
@@ -69,37 +58,44 @@ export var EntityNameKWValidationSchema = function () {
69
58
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
70
59
  if (length === 0)
71
60
  return true;
72
- 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();
73
74
  }
74
- });
75
- })
76
- .required(''),
77
- issuingDate: yup.string().required('choose_any_issuing_date'),
78
- 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'),
79
90
  certificateId: yup.array().optional(),
80
91
  articleId: yup.string().optional()
81
92
  });
82
93
  };
83
- export var EntityNameOtherCountryValidationSchema = function () {
94
+ export var EntityNameOtherCountryValidationSchema = function (noneEditable) {
84
95
  return yup.object().shape({
85
- legalName: yup
86
- .string()
87
- .required('')
88
- .test({
89
- test: function (value) {
90
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
91
- if (length === 0)
92
- return true;
93
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
94
- }
95
- }),
96
- licenseType: yup.string().optional(),
97
- entityType: yup.string().required('entity_type_required'),
98
- licenseNumber: yup
99
- .string()
100
- .when('licenseType', function (licenseType) {
101
- var isCR = licenseType === BusinessType.CR;
102
- return yup
96
+ legalName: noneEditable['legal_name.en'] && noneEditable['legal_name.ar']
97
+ ? yup.string().optional()
98
+ : yup
103
99
  .string()
104
100
  .required('')
105
101
  .test({
@@ -107,13 +103,32 @@ export var EntityNameOtherCountryValidationSchema = function () {
107
103
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
108
104
  if (length === 0)
109
105
  return true;
110
- 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' });
111
107
  }
112
- });
113
- })
114
- .required(''),
115
- issuingDate: yup.string().required('choose_any_issuing_date'),
116
- 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'),
117
132
  certificateId: yup.array().optional(),
118
133
  articleId: yup.string().optional()
119
134
  });
@@ -12,4 +12,3 @@ export declare const entityFeatureScreens: Array<FeatureScreenStep>;
12
12
  export declare const brandFeatureScreens: Array<FeatureScreenStep>;
13
13
  export declare const boardFeatureScreens: Array<FeatureScreenStep>;
14
14
  export declare const kycFeatureScreens: Array<FeatureScreenStep>;
15
- export declare const terminalFeatureScreens: Array<FeatureScreenStep>;