@tap-payments/auth-jsconnect 2.0.39-test → 2.0.39

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 (298) hide show
  1. package/build/@types/app.d.ts +50 -20
  2. package/build/@types/app.js +9 -3
  3. package/build/@types/form.d.ts +21 -12
  4. package/build/api/auth.d.ts +28 -5
  5. package/build/api/auth.js +36 -1
  6. package/build/api/axios.js +2 -2
  7. package/build/api/brand.d.ts +2 -1
  8. package/build/api/brand.js +10 -1
  9. package/build/api/country.d.ts +3 -1
  10. package/build/api/country.js +3 -1
  11. package/build/api/data.d.ts +38 -7
  12. package/build/api/data.js +57 -17
  13. package/build/api/entity.d.ts +51 -5
  14. package/build/api/entity.js +39 -9
  15. package/build/api/firebase.d.ts +1 -1
  16. package/build/api/firebase.js +3 -1
  17. package/build/api/index.d.ts +44 -14
  18. package/build/api/individual.d.ts +76 -19
  19. package/build/api/individual.js +29 -2
  20. package/build/api/lead.d.ts +9 -6
  21. package/build/api/lead.js +8 -1
  22. package/build/app/rootReducer.d.ts +0 -1
  23. package/build/app/rootReducer.js +0 -2
  24. package/build/app/settings.d.ts +8 -2
  25. package/build/app/settings.js +21 -10
  26. package/build/app/store.d.ts +1 -3
  27. package/build/assets/locales/ar.json +258 -183
  28. package/build/assets/locales/en.json +190 -108
  29. package/build/components/AnimationFlow/AnimationFlow.d.ts +4 -1
  30. package/build/components/AnimationFlow/AnimationFlow.js +6 -8
  31. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  32. package/build/components/AnimationFlow/BottomSheet.js +4 -3
  33. package/build/components/AnimationFlow/Dialog.d.ts +4 -1
  34. package/build/components/AnimationFlow/Dialog.js +5 -3
  35. package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
  36. package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
  37. package/build/components/ArabicDatePicker/index.d.ts +2 -0
  38. package/build/components/ArabicDatePicker/index.js +2 -0
  39. package/build/components/ArabicDatePicker/style.css +24 -0
  40. package/build/components/FileInput/DragAndDrop.d.ts +10 -1
  41. package/build/components/FileInput/DragAndDrop.js +108 -8
  42. package/build/components/Lottie/Lottie.d.ts +878 -0
  43. package/build/components/Lottie/Lottie.js +58 -0
  44. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  45. package/build/components/Lottie/files/success.json +425 -0
  46. package/build/components/Lottie/index.d.ts +3 -0
  47. package/build/components/Lottie/index.js +3 -0
  48. package/build/components/OTPField/OTPField.d.ts +2 -1
  49. package/build/components/OTPField/OTPField.js +2 -2
  50. package/build/components/OTPTimer/OTPTimer.js +1 -1
  51. package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
  52. package/build/components/ProgressBar/CircularProgressBar.js +48 -0
  53. package/build/components/ProgressBar/index.d.ts +2 -0
  54. package/build/components/ProgressBar/index.js +2 -0
  55. package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
  56. package/build/components/RadioLabel/RadioLabel.js +2 -2
  57. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -6
  58. package/build/components/SocialMediaGroup/SocialMediaGroup.js +4 -49
  59. package/build/constants/api.d.ts +6 -0
  60. package/build/constants/api.js +14 -1
  61. package/build/constants/app.d.ts +4 -5
  62. package/build/constants/app.js +51 -28
  63. package/build/constants/assets.d.ts +14 -0
  64. package/build/constants/assets.js +16 -2
  65. package/build/constants/dummy.d.ts +1 -1
  66. package/build/constants/dummy.js +2 -2
  67. package/build/constants/validation.d.ts +10 -0
  68. package/build/constants/validation.js +11 -1
  69. package/build/features/app/auth/authStore.d.ts +30 -4
  70. package/build/features/app/auth/authStore.js +182 -20
  71. package/build/features/app/bank/bankStore.d.ts +16 -0
  72. package/build/features/app/bank/bankStore.js +88 -41
  73. package/build/features/app/business/businessStore.d.ts +22 -3
  74. package/build/features/app/business/businessStore.js +445 -296
  75. package/build/features/app/connect/connectStore.d.ts +34 -31
  76. package/build/features/app/connect/connectStore.js +427 -300
  77. package/build/features/app/entity/entityStore.d.ts +29 -7
  78. package/build/features/app/entity/entityStore.js +253 -148
  79. package/build/features/app/individual/individualStore.d.ts +18 -0
  80. package/build/features/app/individual/individualStore.js +178 -85
  81. package/build/features/app/password/passwordStore.js +5 -5
  82. package/build/features/app/tax/taxStore.js +23 -16
  83. package/build/features/auth/Auth.d.ts +3 -1
  84. package/build/features/auth/Auth.js +40 -11
  85. package/build/features/auth/screens/NID/DOB.d.ts +7 -0
  86. package/build/features/auth/screens/NID/DOB.js +47 -0
  87. package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
  88. package/build/features/auth/screens/NID/IDNumber.js +64 -0
  89. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  90. package/build/features/auth/screens/NID/NID.js +68 -0
  91. package/build/features/auth/screens/NID/TAC.d.ts +3 -0
  92. package/build/features/auth/screens/NID/TAC.js +87 -0
  93. package/build/features/auth/screens/NID/index.d.ts +3 -0
  94. package/build/features/auth/screens/NID/index.js +2 -0
  95. package/build/features/auth/screens/NID/validation.d.ts +27 -0
  96. package/build/features/auth/screens/NID/validation.js +19 -0
  97. package/build/features/auth/screens/OTP/OTP.js +8 -4
  98. package/build/features/auth/screens/OTP/OTPInput.js +9 -2
  99. package/build/features/bank/Bank.js +4 -4
  100. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
  101. package/build/features/bank/screens/BankDetails/BankName.js +2 -1
  102. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  103. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  104. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  105. package/build/features/bank/screens/Success/Success.js +7 -3
  106. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
  107. package/build/features/business/Business.d.ts +1 -1
  108. package/build/features/business/Business.js +7 -6
  109. package/build/features/business/screens/Activities/Activities.js +16 -17
  110. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  111. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  112. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  113. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  114. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  115. package/build/features/business/screens/Activities/validation.js +0 -9
  116. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  117. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  118. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  119. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  120. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  121. package/build/features/business/screens/BusinessType/LicenseList.js +26 -7
  122. package/build/features/business/screens/BusinessType/LicenseNumber.js +12 -6
  123. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  124. package/build/features/business/screens/BusinessType/LicenseType.js +78 -0
  125. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  126. package/build/features/business/screens/BusinessType/validation.js +52 -3
  127. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  128. package/build/features/business/screens/CivilID/CivilID.js +67 -0
  129. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  130. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  131. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  132. package/build/features/business/screens/CivilID/index.js +2 -0
  133. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  134. package/build/features/business/screens/CivilID/validation.js +4 -0
  135. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  136. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  137. package/build/features/business/screens/Customers/Customers.js +15 -9
  138. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  139. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  140. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  141. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  142. package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
  143. package/build/features/business/screens/OTP/OTP.js +15 -2
  144. package/build/features/business/screens/Success/Success.js +10 -3
  145. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -10
  146. package/build/features/business/screens/Verify/Verify.js +4 -4
  147. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  148. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
  149. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  150. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  151. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  152. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  153. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  154. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  155. package/build/features/connect/Connect.d.ts +2 -1
  156. package/build/features/connect/Connect.js +41 -12
  157. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  158. package/build/features/connect/screens/CivilID/CivilID.js +102 -0
  159. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  160. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  161. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  162. package/build/features/connect/screens/CivilID/index.js +2 -0
  163. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  164. package/build/features/connect/screens/CivilID/validation.js +4 -0
  165. package/build/features/connect/screens/Individual/Email.js +11 -3
  166. package/build/features/connect/screens/Individual/Individual.js +44 -28
  167. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  168. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  169. package/build/features/connect/screens/Merchant/Merchant.js +41 -64
  170. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
  171. package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
  172. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  173. package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
  174. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  175. package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
  176. package/build/features/connect/screens/Merchant/validation.js +108 -173
  177. package/build/features/connect/screens/Mobile/Mobile.js +33 -12
  178. package/build/features/connect/screens/NID/NID.js +5 -1
  179. package/build/features/connect/screens/OTP/OTP.js +20 -6
  180. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  181. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  182. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  183. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  184. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  185. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  186. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  187. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  188. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  189. package/build/features/entity/Entity.d.ts +1 -1
  190. package/build/features/entity/Entity.js +9 -8
  191. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +2 -1
  192. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +25 -15
  193. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
  194. package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
  195. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +38 -10
  196. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
  197. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
  198. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +34 -5
  199. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
  200. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +75 -41
  201. package/build/features/entity/screens/EntityInfoConfirm/validation.js +76 -10
  202. package/build/features/entity/screens/Success/Success.js +7 -3
  203. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -8
  204. package/build/features/entity/screens/Verify/Verify.js +18 -5
  205. package/build/features/featuresScreens.d.ts +0 -1
  206. package/build/features/featuresScreens.js +25 -7
  207. package/build/features/individual/Individual.d.ts +1 -1
  208. package/build/features/individual/Individual.js +7 -6
  209. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
  210. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  211. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  212. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  213. package/build/features/individual/screens/Success/Success.js +7 -3
  214. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
  215. package/build/features/individual/screens/Verify/Verify.js +18 -5
  216. package/build/features/password/Password.d.ts +1 -1
  217. package/build/features/password/Password.js +7 -6
  218. package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
  219. package/build/features/password/screens/OTP/OTP.js +15 -2
  220. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -12
  221. package/build/features/password/screens/Verify/Verify.js +16 -3
  222. package/build/features/shared/Background/Background.d.ts +2 -5
  223. package/build/features/shared/Background/Background.js +7 -3
  224. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  225. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  226. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  227. package/build/features/shared/Button/MobileButton.js +2 -2
  228. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  229. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  230. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  231. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  232. package/build/features/shared/Dialog/index.d.ts +4 -0
  233. package/build/features/shared/Dialog/index.js +4 -0
  234. package/build/features/shared/Input/Input.d.ts +1 -1
  235. package/build/features/shared/Input/Input.js +2 -2
  236. package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -2
  237. package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
  238. package/build/features/shared/UploadFile/UploadFile.js +24 -9
  239. package/build/features/signIn/SignIn.d.ts +1 -1
  240. package/build/features/signIn/SignIn.js +7 -6
  241. package/build/features/signIn/screens/Email/Email.js +4 -2
  242. package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
  243. package/build/features/signIn/screens/OTP/OTP.js +14 -1
  244. package/build/features/signIn/screens/Password/Password.js +15 -2
  245. package/build/features/tax/Tax.d.ts +1 -1
  246. package/build/features/tax/Tax.js +9 -8
  247. package/build/features/tax/screens/Success/Success.js +9 -3
  248. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -10
  249. package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
  250. package/build/features/tax/screens/Verify/Verify.js +16 -3
  251. package/build/hooks/index.d.ts +2 -0
  252. package/build/hooks/index.js +2 -0
  253. package/build/hooks/useAppConfig.d.ts +3 -1
  254. package/build/hooks/useAppConfig.js +2 -2
  255. package/build/hooks/useAppDispatch.d.ts +0 -1
  256. package/build/hooks/useErrorListener.js +0 -6
  257. package/build/hooks/useScreen.d.ts +3 -0
  258. package/build/hooks/useScreen.js +14 -0
  259. package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
  260. package/build/hooks/useSetFromDefaultValues.js +24 -0
  261. package/build/index.d.ts +2 -3
  262. package/build/index.js +1 -4
  263. package/build/utils/array.d.ts +49 -1
  264. package/build/utils/array.js +58 -0
  265. package/build/utils/common.d.ts +1 -0
  266. package/build/utils/common.js +3 -0
  267. package/build/utils/device.d.ts +1 -0
  268. package/build/utils/device.js +13 -0
  269. package/build/utils/index.d.ts +1 -0
  270. package/build/utils/index.js +1 -0
  271. package/build/utils/locale.js +1 -1
  272. package/build/utils/object.d.ts +1 -0
  273. package/build/utils/object.js +12 -0
  274. package/build/utils/rsa.d.ts +2 -2
  275. package/build/utils/rsa.js +1 -1
  276. package/build/utils/string.d.ts +33 -20
  277. package/build/utils/string.js +71 -1
  278. package/build/utils/validation.d.ts +2 -0
  279. package/build/utils/validation.js +6 -0
  280. package/package.json +5 -4
  281. package/build/features/app/otp/otpStore.d.ts +0 -28
  282. package/build/features/app/otp/otpStore.js +0 -153
  283. package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
  284. package/build/features/business/screens/Activities/SalesChannels.js +0 -112
  285. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
  286. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
  287. package/build/features/otp/OTP.d.ts +0 -7
  288. package/build/features/otp/OTP.js +0 -58
  289. package/build/features/otp/index.d.ts +0 -0
  290. package/build/features/otp/index.js +0 -1
  291. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  292. package/build/features/otp/screens/OTPVerify/OTPInput.js +0 -47
  293. package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
  294. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  295. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  296. package/build/features/otp/screens/OTPVerify/index.js +0 -2
  297. package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
  298. package/build/features/otp/screens/OTPVerify/validation.js +0 -4
@@ -1,12 +1,31 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { InputLabelStyled } from './ActivitiesList';
3
13
  import { useTranslation } from 'react-i18next';
4
14
  import { useController, useFormContext } from 'react-hook-form';
5
15
  import DatePicker from '../../../../components/DatePicker';
16
+ import Text from '../../../../components/Text';
6
17
  import { ScreenContainer } from '../../../shared/Containers';
7
- import { MandatoryStyled } from './SalesChannels';
8
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
9
19
  import { businessSelector, clearError } from '../../../app/business/businessStore';
20
+ import { alpha, styled } from '@mui/material/styles';
21
+ export var InputLabelStyled = styled(Text)(function (_a) {
22
+ var theme = _a.theme;
23
+ return (__assign({ margin: theme.spacing(2.5, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
24
+ });
25
+ export var MandatoryStyled = styled('span')(function (_a) {
26
+ var theme = _a.theme;
27
+ return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
28
+ });
10
29
  var OperationStartDate = function (_a) {
11
30
  var _b;
12
31
  var onDateClicked = _a.onDateClicked;
@@ -16,23 +16,6 @@ export declare const ActivitiesValidationSchema: yup.ObjectSchema<import("yup/li
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
- salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
20
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
22
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
25
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
26
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
27
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
28
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
29
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
30
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
31
- }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
32
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
33
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
34
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
35
- }>>[] | undefined>;
36
19
  operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
37
20
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
38
21
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
@@ -51,23 +34,6 @@ export declare const ActivitiesValidationSchema: yup.ObjectSchema<import("yup/li
51
34
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
52
35
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
53
36
  }>>[] | undefined>;
54
- salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
55
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
56
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
57
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
58
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
59
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
60
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
61
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
62
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
63
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
64
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
65
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
66
- }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
67
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
68
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
69
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
70
- }>>[] | undefined>;
71
37
  operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
72
38
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
73
39
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
@@ -86,22 +52,5 @@ export declare const ActivitiesValidationSchema: yup.ObjectSchema<import("yup/li
86
52
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
87
53
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
88
54
  }>>[] | undefined>;
89
- salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
90
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
91
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
92
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
93
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
94
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
95
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
96
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
97
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
98
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
99
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
100
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
101
- }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
102
- id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
103
- name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
104
- name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
105
- }>>[] | undefined>;
106
55
  operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
107
56
  }>>>;
@@ -4,14 +4,5 @@ export var ActivitiesValidationSchema = yup.object().shape({
4
4
  ar: yup.string(),
5
5
  en: yup.string()
6
6
  })),
7
- salesChannels: yup
8
- .array()
9
- .min(1, 'choose_atleast_one_channel')
10
- .of(yup.object().shape({
11
- id: yup.string(),
12
- name_en: yup.string(),
13
- name_ar: yup.string()
14
- }))
15
- .required('choose_atleast_one_channel'),
16
7
  operationStartDate: yup.string().required('choose_any_business_date')
17
8
  });
@@ -15,24 +15,34 @@ import { useForm, FormProvider } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
18
- import { handlePrevScreenStep } from '../../../../app/settings';
18
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
19
19
  import Form from '../../../../components/Form';
20
20
  import Collapse from '../../../../components/Collapse';
21
21
  import { useLanguage } from '../../../../hooks';
22
22
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
23
  import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
24
24
  import Button from '../../../shared/Button';
25
- import { LicenseValidationSchema } from './validation';
25
+ import { isSA } from '../../../../utils';
26
+ import { KWLicenseValidationSchema, LicenseValidationSchema } from './validation';
26
27
  import LicenseList from './LicenseList';
27
28
  var BusinessType = function (_a) {
28
- var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
29
+ var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading;
30
+ var settingsData = useAppSelector(settingsSelector).data;
31
+ var businessTypeData = data.businessTypeData;
29
32
  var t = useTranslation().t;
30
33
  var isAr = useLanguage().isAr;
31
34
  var dispatch = useAppDispatch();
32
35
  var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
36
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
33
37
  var methods = useForm({
34
- resolver: yupResolver(LicenseValidationSchema),
35
- defaultValues: data.businessTypeData,
38
+ resolver: yupResolver(!isSACountry ? KWLicenseValidationSchema : LicenseValidationSchema),
39
+ defaultValues: {
40
+ selectedLicense: businessTypeData.selectedLicense,
41
+ licenseNumber: businessTypeData.licenseNumber,
42
+ entityLegalName: businessTypeData.entityLegalName,
43
+ certificateId: businessTypeData.certificateId,
44
+ certificateFile: businessTypeData.certificateFile
45
+ },
36
46
  mode: 'onChange'
37
47
  });
38
48
  React.useEffect(function () {
@@ -42,14 +52,17 @@ var BusinessType = function (_a) {
42
52
  var onSubmit = function (data) {
43
53
  var dataValues = {
44
54
  selectedLicense: data.selectedLicense,
45
- licenseNumber: data.licenseNumber
55
+ licenseNumber: data.licenseNumber,
56
+ entityLegalName: data.entityLegalName,
57
+ certificateId: data.certificateId,
58
+ certificateFile: data.certificateFile
46
59
  };
47
60
  dispatch(updateLeadBusinessType(dataValues));
48
61
  };
49
62
  var onBack = function () {
50
63
  dispatch(handlePrevScreenStep());
51
64
  };
52
- var disabled = !methods.formState.isValid || !!error;
65
+ var disabled = !methods.formState.isValid || !!error || uploading;
53
66
  var disableBack = !data.otpData.isNID;
54
67
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(LicenseList, { onListOpen: function () {
55
68
  setListActive(true);
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface EntityNameProps {
3
+ show: boolean;
4
+ }
5
+ declare const EntityName: ({ show }: EntityNameProps) => JSX.Element;
6
+ export default EntityName;
@@ -0,0 +1,56 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import ClearIcon from '../../../shared/ClearIcon';
15
+ import CheckIcon from '../../../shared/CheckIcon';
16
+ import Input from '../../../shared/Input';
17
+ import Collapse from '../../../../components/Collapse';
18
+ import { useTranslation } from 'react-i18next';
19
+ import { useController, useFormContext } from 'react-hook-form';
20
+ import { isSA, removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
21
+ import { styled } from '@mui/material/styles';
22
+ import Box from '@mui/material/Box';
23
+ import { useAppSelector } from '../../../../hooks';
24
+ import { settingsSelector } from '../../../../app/settings';
25
+ var BoxStyled = styled(Box)(function (_a) {
26
+ var theme = _a.theme;
27
+ return ({
28
+ display: 'flex',
29
+ flexDirection: 'column',
30
+ direction: theme.direction,
31
+ fontFamily: theme.typography.fontFamily,
32
+ overflow: 'hidden',
33
+ paddingBlockEnd: theme.spacing(2.5)
34
+ });
35
+ });
36
+ var EntityName = function (_a) {
37
+ var _b;
38
+ var show = _a.show;
39
+ var t = useTranslation().t;
40
+ var control = useFormContext().control;
41
+ var entityNameControl = useController({ control: control, name: 'entityLegalName' });
42
+ var entityNameValue = entityNameControl.field.value;
43
+ var error = (_b = entityNameControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
44
+ var settingsData = useAppSelector(settingsSelector).data;
45
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
46
+ var handleChange = function (_a) {
47
+ var target = _a.target;
48
+ var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
49
+ entityNameControl.field.onChange(value);
50
+ };
51
+ var clearEntityName = function () {
52
+ entityNameControl.field.onChange('');
53
+ };
54
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(BoxStyled, { children: _jsx(Input, { label: t('entity_legal_name_title'), onChange: handleChange, value: entityNameValue, required: !isSACountry, endAdornment: (entityNameValue === null || entityNameValue === void 0 ? void 0 : entityNameValue.length) >= 3 ? _jsx(CheckIcon, {}) : entityNameValue && _jsx(ClearIcon, { onClick: clearEntityName }), placeholder: t('entity_legal_name_placeholder'), warningType: 'alert', warningMessage: error && t(error) }) }) })));
55
+ };
56
+ export default EntityName;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface LicenseCertificateProps {
3
+ show: boolean;
4
+ }
5
+ declare const LicenseCertificate: ({ show }: LicenseCertificateProps) => JSX.Element;
6
+ export default LicenseCertificate;
@@ -0,0 +1,76 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import React from 'react';
14
+ import { styled } from '@mui/material/styles';
15
+ import { ScreenContainer } from '../../../shared/Containers';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { useController, useFormContext } from 'react-hook-form';
18
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
+ import { businessSelector, uploadLicenseCertificate } from '../../../app/business/businessStore';
20
+ import UploadFile from '../../../shared/UploadFile';
21
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
22
+ import Collapse from '../../../../components/Collapse';
23
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
24
+ var theme = _a.theme;
25
+ return ({
26
+ marginBlockStart: theme.spacing(3)
27
+ });
28
+ });
29
+ var LicenseCertificate = function (_a) {
30
+ var _b, _c;
31
+ var show = _a.show;
32
+ var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
33
+ var t = useTranslation().t;
34
+ var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors;
35
+ var certificateFileControl = useController({ name: 'certificateFile', control: control });
36
+ var certificateIdControl = useController({ name: 'certificateId', control: control });
37
+ var _f = useAppSelector(businessSelector), loading = _f.loading, uploading = _f.uploading, sysError = _f.error;
38
+ var dispatch = useAppDispatch();
39
+ var certificateValue = certificateFileControl.field.value;
40
+ var error = ((_b = certificateFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = certificateIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
41
+ var handleLicenseCertificateChange = function (file) {
42
+ if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
43
+ setError('certificateFile', { message: 'file_not_supported_alert' });
44
+ }
45
+ else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
46
+ setError('certificateFile', { message: 'file_size_alert' });
47
+ }
48
+ else {
49
+ certificateFileControl.field.onChange(file);
50
+ dispatch(uploadLicenseCertificate({
51
+ file: file,
52
+ onProgress: function (value) {
53
+ setProgress(value);
54
+ }
55
+ }));
56
+ }
57
+ };
58
+ var handleReset = function () {
59
+ certificateFileControl.field.onChange(null);
60
+ certificateIdControl.field.onChange('');
61
+ setProgress(0);
62
+ };
63
+ React.useEffect(function () {
64
+ if (sysError === 'file_upload_error') {
65
+ setError('certificateId', { message: sysError });
66
+ certificateFileControl.field.onChange(null);
67
+ setProgress(0);
68
+ }
69
+ }, [sysError]);
70
+ React.useEffect(function () {
71
+ if ((certificateFileControl.formState.isValid || !!certificateValue) && error != 'file_upload_error')
72
+ clearErrors();
73
+ }, [certificateFileControl.formState.isValid, certificateValue]);
74
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_license_certificate'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleLicenseCertificateChange, isFileUploaded: !uploading && !!certificateValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
75
+ };
76
+ export default LicenseCertificate;
@@ -37,6 +37,12 @@ import Text from '../../../../components/Text';
37
37
  import ExpandIcon from '../../../../components/ExpandIcon';
38
38
  import Collapse from '../../../../components/Collapse';
39
39
  import LicenseNumber from './LicenseNumber';
40
+ import EntityName from '../../../business/screens/BusinessType/EntityName';
41
+ import { isSA } from '../../../../utils';
42
+ import LicenseType from './LicenseType';
43
+ import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
44
+ import LicenseCertificate from './LicenseCertificate';
45
+ import { settingsSelector } from '../../../../app/settings';
40
46
  var InputStyled = styled(Input)(function (_a) {
41
47
  var theme = _a.theme;
42
48
  return ({
@@ -56,6 +62,7 @@ var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return
56
62
  var LicenseList = function (_a) {
57
63
  var rest = __rest(_a, []);
58
64
  var _b = useAppSelector(businessSelector), data = _b.data, error = _b.error;
65
+ var settingsData = useAppSelector(settingsSelector).data;
59
66
  var businessTypeData = data.businessTypeData;
60
67
  var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
61
68
  var t = useTranslation().t;
@@ -63,8 +70,9 @@ var LicenseList = function (_a) {
63
70
  var dispatch = useAppDispatch();
64
71
  var _d = useFormContext(), setValue = _d.setValue, control = _d.control;
65
72
  var selectedLicenseControl = useController({ control: control, name: 'selectedLicense' });
66
- var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense, licenseNumber = businessTypeData.licenseNumber;
73
+ var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense, licenseNumber = businessTypeData.licenseNumber, entityLegalName = businessTypeData.entityLegalName;
67
74
  var licenseList = (responseBody || { licenseList: [] }).licenseList;
75
+ var country_code = settingsData.businessCountry.iso2;
68
76
  var onOpenLicenseList = function (event) {
69
77
  var _a;
70
78
  setAnchorEl(event.currentTarget);
@@ -75,18 +83,29 @@ var LicenseList = function (_a) {
75
83
  setAnchorEl(null);
76
84
  (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
77
85
  };
86
+ var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
78
87
  React.useEffect(function () {
79
- if (licenseList.length > 0)
88
+ if ((licenseList || []).length > 0)
80
89
  setValue('licenseList', licenseList);
81
90
  }, [licenseList]);
82
91
  React.useEffect(function () {
83
- if (licenseList.length > 0) {
92
+ if ((licenseList || []).length > 0) {
84
93
  if (!!selectedLicense) {
85
94
  setValue('selectedLicense', selectedLicense, { shouldValidate: true });
86
95
  setValue('licenseNumber', licenseNumber, { shouldValidate: true });
87
96
  }
88
97
  }
89
98
  }, [licenseList, selectedLicense]);
99
+ React.useEffect(function () {
100
+ if (!!country_code) {
101
+ var isNonSA = !isSA(country_code);
102
+ if (isNonSA) {
103
+ var license = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL ? OTHER_FL_LICENSE : OTHER_CR_LICENSE;
104
+ setValue('selectedLicense', license, { shouldValidate: true });
105
+ setValue('entityLegalName', entityLegalName, { shouldValidate: true });
106
+ }
107
+ }
108
+ }, [country_code]);
90
109
  var getLicenseNumber = function (item) {
91
110
  var _a;
92
111
  return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
@@ -116,13 +135,13 @@ var LicenseList = function (_a) {
116
135
  return _jsx("span", { children: "".concat(getLicenseName(item), " - ").concat(getLicenseNumber(item)) });
117
136
  return _jsx("span", { children: "".concat(getLicenseNumber(item), " - ").concat(getLicenseName(item)) });
118
137
  };
119
- var showLicenseNumber = !anchorEl;
138
+ var show = !anchorEl;
120
139
  var selected = selectedLicenseControl.field.value;
121
140
  var licenseReadonly = !isOtherLicense(selected);
122
141
  var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
123
142
  var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
124
- return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
125
- return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
126
- } }) })), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: licenseReadonly })] }));
143
+ return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
144
+ return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
145
+ } }) }))] })), _jsx(EntityName, { show: show && !isSACountry }), _jsx(LicenseType, { show: show && !isSACountry }), _jsx(LicenseNumber, { show: !isSACountry ? isCR : show, readOnly: licenseReadonly }), _jsx(LicenseCertificate, { show: show && !isSACountry && isCR })] }));
127
146
  };
128
147
  export default React.memo(LicenseList);
@@ -13,21 +13,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
- import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
16
+ import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
+ import { removeAllOtherThanCharsAndNumber, isSA } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
21
21
  import Input from '../../../shared/Input';
22
22
  import Collapse from '../../../../components/Collapse';
23
23
  import { BusinessType } from '../../../../@types';
24
+ import { useAppSelector } from '../../../../hooks';
25
+ import { settingsSelector } from '../../../../app/settings';
24
26
  var LicenseNumber = function (_a) {
25
27
  var _b;
26
28
  var show = _a.show, readOnly = _a.readOnly;
27
29
  var t = useTranslation().t;
28
- var _c = useFormContext(), control = _c.control, getValues = _c.getValues;
30
+ var _c = useFormContext(), control = _c.control, watch = _c.watch, getValues = _c.getValues;
29
31
  var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
30
- var selectedLicense = getValues('selectedLicense');
32
+ var settingsData = useAppSelector(settingsSelector).data;
33
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
+ var selectedLicense = !isSACountry ? watch('selectedLicense') : getValues('selectedLicense');
31
35
  var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
32
36
  var handleFLNumberChange = function (_a) {
33
37
  var target = _a.target;
@@ -39,8 +43,10 @@ var LicenseNumber = function (_a) {
39
43
  };
40
44
  var licenseNumberValue = licenseNumberControl.field.value;
41
45
  var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
42
- var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
46
+ var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
47
+ var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : length;
43
48
  var label = isCR ? 'cr_number' : 'fl_number';
44
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
49
+ var showCheckIcon = !isSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
50
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
45
51
  };
46
52
  export default React.memo(LicenseNumber);
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare type LicenseTypeProps = {
3
+ show: boolean;
4
+ };
5
+ declare const LicenseType: ({ show }: LicenseTypeProps) => JSX.Element;
6
+ export default LicenseType;
@@ -0,0 +1,78 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { styled, alpha } from '@mui/material/styles';
15
+ import Collapse from '../../../../components/Collapse';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { useController, useFormContext } from 'react-hook-form';
18
+ import Text from '../../../../components/Text';
19
+ import { ScreenContainer } from '../../../shared/Containers';
20
+ import Mandatory from '../../../shared/Mandatory';
21
+ import RadioLabel from '../../../../components/RadioLabel';
22
+ import { BusinessType } from '../../../../@types';
23
+ import RadioGroup from '../../../../components/RadioGroup';
24
+ import Radio from '../../../../components/Radio';
25
+ import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
26
+ import { businessSelector, clearError } from '../../../app/business/businessStore';
27
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
28
+ import { isKW } from '../../../../utils';
29
+ import { settingsSelector } from '../../../../app/settings';
30
+ var LabelTextStyled = styled(Text)(function (_a) {
31
+ var theme = _a.theme;
32
+ return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
33
+ });
34
+ var RadioGroupStyled = styled(RadioGroup)(function (_a) {
35
+ var theme = _a.theme;
36
+ return ({
37
+ marginInlineStart: theme.spacing(0.25)
38
+ });
39
+ });
40
+ var RadioStyled = styled(Radio)(function (_a) {
41
+ var theme = _a.theme;
42
+ return ({
43
+ '& .MuiSvgIcon-root': {
44
+ fontSize: theme.spacing(2.25),
45
+ width: theme.spacing(2.25),
46
+ height: theme.spacing(2.25)
47
+ }
48
+ });
49
+ });
50
+ var LicenseType = function (_a) {
51
+ var show = _a.show;
52
+ var t = useTranslation().t;
53
+ var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
54
+ var error = useAppSelector(businessSelector).error;
55
+ var settingsData = useAppSelector(settingsSelector).data;
56
+ var country_code = settingsData.businessCountry.iso2;
57
+ var selectedLicenseControl = useController({ control: control, name: 'selectedLicense' });
58
+ var dispatch = useAppDispatch();
59
+ var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
60
+ var handleOnChange = function (_a) {
61
+ var target = _a.target;
62
+ if (error)
63
+ dispatch(clearError());
64
+ selectedLicenseControl.field.onChange(target.value === BusinessType.FL ? OTHER_FL_LICENSE : OTHER_CR_LICENSE);
65
+ if (isKWCountry && target.value === BusinessType.FL) {
66
+ setValue('licenseNumber', '', { shouldValidate: true });
67
+ setValue('certificateFile', undefined, { shouldValidate: true });
68
+ setValue('certificateId', undefined, { shouldValidate: true });
69
+ }
70
+ };
71
+ var selectedLicenseValue = selectedLicenseControl.field.value;
72
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 1.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(LabelTextStyled, { children: [t('signup_business_type_label'), _jsx(Mandatory, {})] }), _jsxs(RadioGroupStyled, __assign({ value: selectedLicenseValue != null
73
+ ? (selectedLicenseValue === null || selectedLicenseValue === void 0 ? void 0 : selectedLicenseValue.type) === BusinessType.FL
74
+ ? BusinessType.FL
75
+ : BusinessType.CR
76
+ : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: BusinessType.CR, label: t('commercial_reg'), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) }), _jsx(RadioLabel, { value: BusinessType.FL, label: t('homemaker_reg'), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) })] }))] })) })));
77
+ };
78
+ export default LicenseType;
@@ -9,3 +9,22 @@ export declare const LicenseValidationSchema: yup.ObjectSchema<import("yup/lib/o
9
9
  selectedLicense: any;
10
10
  licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>>;
12
+ export declare const KWLicenseValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
+ selectedLicense: any;
14
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
15
+ entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
16
+ certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
+ certificateFile: any;
18
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
+ selectedLicense: any;
20
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
22
+ certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
+ certificateFile: any;
24
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
25
+ selectedLicense: any;
26
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
27
+ entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
28
+ certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
29
+ certificateFile: any;
30
+ }>>>;