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

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 (314) 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 +9 -2
  25. package/build/app/settings.js +22 -11
  26. package/build/app/store.d.ts +0 -2
  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 +5 -5
  62. package/build/constants/app.js +62 -32
  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 +33 -5
  74. package/build/features/app/business/businessStore.js +487 -350
  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 +40 -8
  78. package/build/features/app/entity/entityStore.js +387 -149
  79. package/build/features/app/individual/individualStore.d.ts +18 -0
  80. package/build/features/app/individual/individualStore.js +168 -89
  81. package/build/features/app/password/passwordStore.d.ts +1 -7
  82. package/build/features/app/password/passwordStore.js +31 -20
  83. package/build/features/app/tax/taxStore.js +23 -16
  84. package/build/features/auth/Auth.d.ts +2 -1
  85. package/build/features/auth/Auth.js +37 -9
  86. package/build/features/auth/screens/NID/DOB.d.ts +7 -0
  87. package/build/features/auth/screens/NID/DOB.js +47 -0
  88. package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
  89. package/build/features/auth/screens/NID/IDNumber.js +64 -0
  90. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  91. package/build/features/auth/screens/NID/NID.js +68 -0
  92. package/build/features/auth/screens/NID/TAC.d.ts +3 -0
  93. package/build/features/auth/screens/NID/TAC.js +87 -0
  94. package/build/features/auth/screens/NID/index.d.ts +3 -0
  95. package/build/features/auth/screens/NID/index.js +2 -0
  96. package/build/features/auth/screens/NID/validation.d.ts +27 -0
  97. package/build/features/auth/screens/NID/validation.js +19 -0
  98. package/build/features/auth/screens/OTP/OTP.js +8 -4
  99. package/build/features/auth/screens/OTP/OTPInput.js +9 -2
  100. package/build/features/bank/Bank.js +4 -4
  101. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
  102. package/build/features/bank/screens/BankDetails/BankName.js +2 -1
  103. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  104. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  105. package/build/features/bank/screens/BankDetails/IBAN.js +4 -1
  106. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  107. package/build/features/bank/screens/Success/Success.js +7 -3
  108. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -12
  109. package/build/features/business/Business.js +4 -4
  110. package/build/features/business/screens/Activities/Activities.js +16 -17
  111. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  112. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  113. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  114. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  115. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  116. package/build/features/business/screens/Activities/validation.js +4 -10
  117. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  118. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  119. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  120. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  121. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  122. package/build/features/business/screens/BusinessType/LicenseList.js +26 -7
  123. package/build/features/business/screens/BusinessType/LicenseNumber.js +12 -6
  124. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  125. package/build/features/business/screens/BusinessType/LicenseType.js +78 -0
  126. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  127. package/build/features/business/screens/BusinessType/validation.js +52 -3
  128. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  129. package/build/features/business/screens/CivilID/CivilID.js +67 -0
  130. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  131. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  132. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  133. package/build/features/business/screens/CivilID/index.js +2 -0
  134. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  135. package/build/features/business/screens/CivilID/validation.js +4 -0
  136. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  137. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  138. package/build/features/business/screens/Customers/Customers.js +15 -9
  139. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  140. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  141. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  142. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  143. package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
  144. package/build/features/business/screens/OTP/OTP.js +15 -2
  145. package/build/features/business/screens/Success/Success.js +10 -3
  146. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -11
  147. package/build/features/business/screens/Verify/Verify.js +4 -4
  148. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  149. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
  150. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  151. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  152. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  153. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  154. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  155. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  156. package/build/features/connect/Connect.d.ts +1 -0
  157. package/build/features/connect/Connect.js +38 -10
  158. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  159. package/build/features/connect/screens/CivilID/CivilID.js +102 -0
  160. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  161. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  162. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  163. package/build/features/connect/screens/CivilID/index.js +2 -0
  164. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  165. package/build/features/connect/screens/CivilID/validation.js +4 -0
  166. package/build/features/connect/screens/Individual/Email.js +11 -3
  167. package/build/features/connect/screens/Individual/Individual.js +44 -28
  168. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  169. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  170. package/build/features/connect/screens/Merchant/Merchant.js +48 -65
  171. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +4 -1
  172. package/build/features/connect/screens/Merchant/SalesChannels.js +28 -31
  173. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +3 -4
  174. package/build/features/connect/screens/Merchant/SocialMedia.js +106 -112
  175. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  176. package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
  177. package/build/features/connect/screens/Merchant/validation.js +106 -173
  178. package/build/features/connect/screens/Mobile/Mobile.js +33 -12
  179. package/build/features/connect/screens/NID/NID.js +5 -1
  180. package/build/features/connect/screens/OTP/OTP.js +20 -6
  181. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  182. package/build/features/connect/screens/ThankYou/ThankYou.js +8 -2
  183. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  184. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  185. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  186. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  187. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  188. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  189. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  190. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  191. package/build/features/entity/Entity.js +6 -6
  192. package/build/features/entity/screens/Customers/CustomerLocations.d.ts +118 -0
  193. package/build/features/entity/screens/Customers/CustomerLocations.js +171 -0
  194. package/build/features/entity/screens/Customers/Customers.d.ts +5 -0
  195. package/build/features/entity/screens/Customers/Customers.js +90 -0
  196. package/build/features/entity/screens/Customers/ExpectedCustomers.d.ts +8 -0
  197. package/build/features/entity/screens/Customers/ExpectedCustomers.js +98 -0
  198. package/build/features/entity/screens/Customers/ExpectedSalesRange.d.ts +8 -0
  199. package/build/features/entity/screens/Customers/ExpectedSalesRange.js +127 -0
  200. package/build/features/entity/screens/Customers/RefundPolicy.d.ts +36 -0
  201. package/build/features/entity/screens/Customers/RefundPolicy.js +84 -0
  202. package/build/features/entity/screens/Customers/TransactionPolicy.d.ts +3 -0
  203. package/build/features/entity/screens/Customers/TransactionPolicy.js +44 -0
  204. package/build/features/entity/screens/Customers/index.d.ts +3 -0
  205. package/build/features/entity/screens/Customers/index.js +2 -0
  206. package/build/features/entity/screens/Customers/validation.d.ts +20 -0
  207. package/build/features/entity/screens/Customers/validation.js +13 -0
  208. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +2 -1
  209. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +25 -15
  210. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
  211. package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
  212. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +38 -10
  213. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
  214. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
  215. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +34 -5
  216. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
  217. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +75 -41
  218. package/build/features/entity/screens/EntityInfoConfirm/validation.js +76 -10
  219. package/build/features/entity/screens/Success/Success.js +7 -3
  220. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -10
  221. package/build/features/entity/screens/Verify/Verify.js +18 -5
  222. package/build/features/featuresScreens.d.ts +0 -1
  223. package/build/features/featuresScreens.js +30 -7
  224. package/build/features/individual/Individual.js +4 -4
  225. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
  226. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  227. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  228. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  229. package/build/features/individual/screens/Success/Success.js +7 -3
  230. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -12
  231. package/build/features/individual/screens/Verify/Verify.js +18 -5
  232. package/build/features/password/Password.js +4 -4
  233. package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
  234. package/build/features/password/screens/OTP/OTP.js +15 -2
  235. package/build/features/password/screens/Success/Success.js +7 -3
  236. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -13
  237. package/build/features/password/screens/Verify/Verify.js +16 -3
  238. package/build/features/shared/Background/Background.d.ts +2 -5
  239. package/build/features/shared/Background/Background.js +7 -3
  240. package/build/features/shared/Button/Button.js +1 -0
  241. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  242. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  243. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  244. package/build/features/shared/Button/MobileButton.js +2 -2
  245. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  246. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  247. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  248. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  249. package/build/features/shared/Dialog/index.d.ts +4 -0
  250. package/build/features/shared/Dialog/index.js +4 -0
  251. package/build/features/shared/Input/Input.d.ts +1 -1
  252. package/build/features/shared/Input/Input.js +2 -2
  253. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +1 -1
  254. package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -2
  255. package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
  256. package/build/features/shared/UploadFile/UploadFile.js +24 -9
  257. package/build/features/signIn/SignIn.js +4 -4
  258. package/build/features/signIn/screens/Email/Email.js +4 -2
  259. package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
  260. package/build/features/signIn/screens/OTP/OTP.js +14 -1
  261. package/build/features/signIn/screens/Password/Password.js +15 -2
  262. package/build/features/tax/Tax.js +6 -6
  263. package/build/features/tax/screens/Success/Success.js +9 -3
  264. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
  265. package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
  266. package/build/features/tax/screens/Verify/Verify.js +16 -3
  267. package/build/hooks/index.d.ts +2 -0
  268. package/build/hooks/index.js +2 -0
  269. package/build/hooks/useAppConfig.d.ts +3 -1
  270. package/build/hooks/useAppConfig.js +2 -2
  271. package/build/hooks/useAppDispatch.d.ts +0 -1
  272. package/build/hooks/useErrorListener.js +0 -6
  273. package/build/hooks/useScreen.d.ts +3 -0
  274. package/build/hooks/useScreen.js +14 -0
  275. package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
  276. package/build/hooks/useSetFromDefaultValues.js +24 -0
  277. package/build/index.d.ts +2 -3
  278. package/build/index.js +1 -4
  279. package/build/utils/array.d.ts +50 -1
  280. package/build/utils/array.js +66 -0
  281. package/build/utils/common.d.ts +1 -0
  282. package/build/utils/common.js +3 -0
  283. package/build/utils/date.d.ts +1 -0
  284. package/build/utils/date.js +5 -0
  285. package/build/utils/device.d.ts +1 -0
  286. package/build/utils/device.js +13 -0
  287. package/build/utils/index.d.ts +2 -0
  288. package/build/utils/index.js +2 -0
  289. package/build/utils/locale.js +1 -1
  290. package/build/utils/object.d.ts +1 -0
  291. package/build/utils/object.js +12 -0
  292. package/build/utils/string.d.ts +14 -0
  293. package/build/utils/string.js +85 -3
  294. package/build/utils/validation.d.ts +2 -0
  295. package/build/utils/validation.js +6 -0
  296. package/package.json +4 -3
  297. package/build/features/app/otp/otpStore.d.ts +0 -28
  298. package/build/features/app/otp/otpStore.js +0 -153
  299. package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
  300. package/build/features/business/screens/Activities/SalesChannels.js +0 -112
  301. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
  302. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
  303. package/build/features/otp/OTP.d.ts +0 -7
  304. package/build/features/otp/OTP.js +0 -58
  305. package/build/features/otp/index.d.ts +0 -0
  306. package/build/features/otp/index.js +0 -1
  307. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  308. package/build/features/otp/screens/OTPVerify/OTPInput.js +0 -47
  309. package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
  310. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  311. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  312. package/build/features/otp/screens/OTPVerify/index.js +0 -2
  313. package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
  314. package/build/features/otp/screens/OTPVerify/validation.js +0 -4
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import { ScreenContainer } from '../../../shared/Containers';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { useController, useFormContext } from 'react-hook-form';
7
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
+ import { entitySelector, uploadArticle } from '../../../app/entity/entityStore';
9
+ import UploadFile from '../../../shared/UploadFile';
10
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
11
+ import { maskFileName } from '../../../../utils';
12
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
13
+ var theme = _a.theme;
14
+ return ({
15
+ marginBlockStart: theme.spacing(3)
16
+ });
17
+ });
18
+ var Article = function () {
19
+ var _a, _b;
20
+ var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
21
+ var t = useTranslation().t;
22
+ var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors, setValue = _d.setValue;
23
+ var articleFileControl = useController({ name: 'articleFile', control: control });
24
+ var articleIdControl = useController({ name: 'articleId', control: control });
25
+ var _e = useAppSelector(entitySelector), loading = _e.loading, uploading = _e.uploading, sysError = _e.error, data = _e.data;
26
+ var dispatch = useAppDispatch();
27
+ var articleValue = articleFileControl.field.value;
28
+ var error = ((_a = articleFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = articleIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
29
+ var entityData = data.entityData;
30
+ var articleFile = entityData.articleFile, articleId = entityData.articleId;
31
+ React.useEffect(function () {
32
+ if (!articleValue) {
33
+ setValue('articleFile', articleFile);
34
+ setValue('articleId', articleId);
35
+ }
36
+ }, [articleFile, articleId]);
37
+ var handleArticleChange = function (file) {
38
+ if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
39
+ setError('articleFile', { message: 'file_not_supported_alert' });
40
+ }
41
+ else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
42
+ setError('articleFile', { message: 'file_size_alert' });
43
+ }
44
+ else {
45
+ articleFileControl.field.onChange(file);
46
+ dispatch(uploadArticle({
47
+ file: file,
48
+ onProgress: function (value) {
49
+ setProgress(value);
50
+ }
51
+ }));
52
+ }
53
+ };
54
+ var handleReset = function () {
55
+ articleFileControl.field.onChange(null);
56
+ articleIdControl.field.onChange('');
57
+ setProgress(0);
58
+ };
59
+ React.useEffect(function () {
60
+ if (sysError === 'file_upload_error') {
61
+ setError('articleId', { message: sysError });
62
+ articleFileControl.field.onChange(null);
63
+ setProgress(0);
64
+ }
65
+ }, [sysError]);
66
+ React.useEffect(function () {
67
+ if ((articleFileControl.formState.isValid || !!articleValue) && error != 'file_upload_error')
68
+ clearErrors();
69
+ }, [articleFileControl.formState.isValid, articleValue]);
70
+ var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
71
+ return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_article'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('article_of_association'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleArticleChange, isFileUploaded: !uploading && !!articleValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error), initialFileName: fileName }) }));
72
+ };
73
+ export default Article;
@@ -9,48 +9,76 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
24
  import { ScreenContainer } from '../../../shared/Containers';
14
25
  import LicenseName from './LicenseName';
15
26
  import * as React from 'react';
16
27
  import LicenseNumber from './LicenseNumber';
17
28
  import ActivitiesList from './ActivitiesList';
18
- import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
19
- import { entitySelector, updateEntityInfo } from '../../../app/entity/entityStore';
29
+ import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues } from '../../../../hooks';
30
+ import { entitySelector, updateEntity } from '../../../app/entity/entityStore';
20
31
  import { FormProvider, useForm } from 'react-hook-form';
21
32
  import { yupResolver } from '@hookform/resolvers/yup';
22
- import { handlePrevScreenStep } from '../../../../app/settings';
33
+ import { BusinessType } from '../../../../@types';
34
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
23
35
  import { styled } from '@mui/system';
24
- import { EntityInfoValidationSchema } from './validation';
36
+ import { EntityInfoValidationSchema, EntityInfoKWValidationSchema } from './validation';
25
37
  import Form from '../../../../components/Form';
26
38
  import Collapse from '../../../../components/Collapse';
27
39
  import Button from '../../../shared/Button';
28
40
  import { useTranslation } from 'react-i18next';
29
41
  import OperationStartDate from './OperationStartDate';
42
+ import Article from './Article';
43
+ import { isKW } from '../../../../utils';
30
44
  var FormStyled = styled(Form)(function () { return ({
31
45
  display: 'flex',
32
46
  flexDirection: 'column'
33
47
  }); });
34
48
  var EntityInfo = function (_a) {
35
49
  var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
36
- var _c = useAppSelector(entitySelector), data = _c.data, loading = _c.loading, error = _c.error;
50
+ var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
51
+ var _d = useAppSelector(entitySelector), data = _d.data, loading = _d.loading, error = _d.error, uploading = _d.uploading;
52
+ var settingsData = useAppSelector(settingsSelector).data;
37
53
  var isAr = useLanguage().isAr;
38
54
  var t = useTranslation().t;
39
55
  var dispatch = useAppDispatch();
56
+ var defaultValues = __rest(data.entityData, []);
57
+ var country_code = settingsData.businessCountry.iso2;
58
+ var licenseType = defaultValues.licenseType;
59
+ var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
60
+ var isCR = React.useMemo(function () { return licenseType === BusinessType.CR; }, [licenseType]);
40
61
  var methods = useForm({
41
- resolver: yupResolver(EntityInfoValidationSchema),
42
- defaultValues: data.entityData,
62
+ resolver: yupResolver(isKWCountry ? EntityInfoKWValidationSchema : EntityInfoValidationSchema),
63
+ defaultValues: defaultValues,
43
64
  mode: 'onChange'
44
65
  });
66
+ useSetFromDefaultValues(methods, defaultValues);
45
67
  var onSubmit = function (data) {
46
- dispatch(updateEntityInfo(__assign({}, data)));
68
+ dispatch(updateEntity(__assign({}, data)));
69
+ };
70
+ var handleCollapseOpenClose = function (flag) {
71
+ setCollapse(flag);
47
72
  };
48
73
  var onBack = function () {
49
- dispatch(handlePrevScreenStep());
74
+ dispatch(handlePrevScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
50
75
  };
51
76
  var handleMenuClick = function () {
52
77
  anchorEl ? setAnchorEl(false) : setAnchorEl(true);
53
78
  };
54
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !anchorEl }, { children: [_jsx(LicenseName, {}), _jsx(LicenseNumber, {})] })), _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !anchorEl }, { children: [_jsx(OperationStartDate, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
79
+ var disabled = !methods.formState.isValid || !!error || uploading;
80
+ var showLicenseNumber = isKWCountry ? isCR : true;
81
+ var showCertificate = isCR;
82
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse && !anchorEl }, { children: [_jsx(LicenseName, {}), _jsx(LicenseNumber, { show: showLicenseNumber })] })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl && showCertificate }, { children: _jsx(Article, {}) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
55
83
  };
56
84
  export default EntityInfo;
@@ -2,16 +2,31 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { ScreenContainer } from '../../../shared/Containers';
5
+ import { useController, useFormContext } from 'react-hook-form';
5
6
  import Input from '../../../shared/Input';
6
7
  import { useAppSelector, useLanguage } from '../../../../hooks';
8
+ import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
7
9
  import { entitySelector } from '../../../app/entity/entityStore';
8
10
  var LicenseName = function (_a) {
9
- var _b, _c, _d;
11
+ var _b, _c;
10
12
  var t = useTranslation().t;
11
- var isAr = useLanguage().isAr;
13
+ var isAr = useLanguage();
14
+ var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
12
15
  var data = useAppSelector(entitySelector).data;
13
- var entity = (((_b = data.verify) === null || _b === void 0 ? void 0 : _b.responseBody) || {}).entity;
14
- var name = isAr ? (_c = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _c === void 0 ? void 0 : _c.ar : (_d = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _d === void 0 ? void 0 : _d.en;
15
- return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('license_name_label'), readOnly: !!name, placeholder: t('license_name_label'), value: name, sx: { '& .MuiInputBase-input': { cursor: 'auto' } } }) }));
16
+ var verify = data.verify;
17
+ var legalName = (_c = (_b = verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.legal_name;
18
+ var name = isAr ? legalName === null || legalName === void 0 ? void 0 : legalName.ar : legalName === null || legalName === void 0 ? void 0 : legalName.en;
19
+ var licenseNameControl = useController({ control: control, name: 'licenseName' });
20
+ var licenseNameValue = licenseNameControl.field.value;
21
+ React.useEffect(function () {
22
+ if (name && !licenseNameValue)
23
+ setValue('licenseName', name, { shouldValidate: true });
24
+ }, [name]);
25
+ var handleChange = function (_a) {
26
+ var target = _a.target;
27
+ var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
28
+ licenseNameControl.field.onChange(value);
29
+ };
30
+ return (_jsx(ScreenContainer, { children: _jsx(Input, { onChange: handleChange, value: licenseNameValue, label: t('license_name_label'), placeholder: t('license_name_label'), sx: { '& .MuiInputBase-input': { cursor: 'auto' } } }) }));
16
31
  };
17
32
  export default React.memo(LicenseName);
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  interface LicenseNumberProps {
3
+ show: boolean;
3
4
  }
4
- declare const _default: React.MemoExoticComponent<({}: LicenseNumberProps) => JSX.Element>;
5
+ declare const _default: React.MemoExoticComponent<({ show }: LicenseNumberProps) => JSX.Element>;
5
6
  export default _default;
@@ -12,17 +12,46 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
15
16
  import { ScreenContainer } from '../../../shared/Containers';
16
17
  import Input from '../../../shared/Input';
17
- import Collapse from '../../../../components/Collapse';
18
18
  import { useAppSelector } from '../../../../hooks';
19
19
  import { entitySelector } from '../../../app/entity/entityStore';
20
+ import { isSA, removeAllOtherThanCharsAndNumber } from '../../../../utils';
21
+ import { BusinessType } from '../../../../@types';
22
+ import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
23
+ import Collapse from '../../../../components/Collapse';
24
+ import { settingsSelector } from '../../../../app/settings';
20
25
  var LicenseNumber = function (_a) {
21
- var _b, _c;
26
+ var _b, _c, _d, _e;
27
+ var show = _a.show;
22
28
  var t = useTranslation().t;
23
29
  var data = useAppSelector(entitySelector).data;
24
- var entity = (((_b = data.verify) === null || _b === void 0 ? void 0 : _b.responseBody) || {}).entity;
25
- var number = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
26
- return (_jsx(Collapse, __assign({ in: !!number }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('license_number_label'), readOnly: true, value: number, sx: { '& .MuiInputBase-input': { cursor: 'auto' } } }) })) })));
30
+ var settingsData = useAppSelector(settingsSelector).data;
31
+ var _f = useFormContext(), control = _f.control, setValue = _f.setValue;
32
+ var entity = (data.verify.responseBody || {}).entity;
33
+ var licenseType = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.type;
34
+ var type = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
35
+ var isLicensedTrue = entity === null || entity === void 0 ? void 0 : entity.is_licensed;
36
+ var hasLicenseNumber = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
37
+ var resLicenseNumber = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
38
+ var licenseNumber = data.entityData.licenseNumber;
39
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
40
+ React.useEffect(function () {
41
+ setValue('licenseNumber', licenseNumber, { shouldValidate: true });
42
+ }, [licenseNumber]);
43
+ var handleChange = function (_a) {
44
+ var target = _a.target;
45
+ var value = removeAllOtherThanCharsAndNumber(target.value);
46
+ licenseNumberControl.field.onChange(value);
47
+ };
48
+ var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
49
+ var licenseNumberValue = licenseNumberControl.field.value;
50
+ var error = (_e = licenseNumberControl.fieldState.error) === null || _e === void 0 ? void 0 : _e.message;
51
+ var isCR = type === BusinessType.CR;
52
+ var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
53
+ var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : length;
54
+ var disabled = hasLicenseNumber && isLicensedTrue && (resLicenseNumber === null || resLicenseNumber === void 0 ? void 0 : resLicenseNumber.length) >= minLength;
55
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('license_number_label'), onChange: handleChange, disabled: disabled, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) })) })));
27
56
  };
28
57
  export default React.memo(LicenseNumber);
@@ -1,38 +1,33 @@
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
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
13
3
  import { useTranslation } from 'react-i18next';
14
4
  import { useController, useFormContext } from 'react-hook-form';
15
- import Input from '../../../shared/Input';
16
5
  import { ScreenContainer } from '../../../shared/Containers';
17
6
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
18
7
  import { entitySelector, clearError } from '../../../app/entity/entityStore';
19
8
  import DatePicker from '../../../../components/DatePicker';
20
9
  import { InputLabelStyled } from './ActivitiesList';
21
10
  var OperationStartDate = function (_a) {
22
- var _b, _c, _d;
11
+ var _b;
23
12
  var onDateClicked = _a.onDateClicked;
24
13
  var t = useTranslation().t;
25
14
  var dispatch = useAppDispatch();
26
- var control = useFormContext().control;
27
- var _e = useAppSelector(entitySelector), data = _e.data, error = _e.error;
15
+ var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
16
+ var _d = useAppSelector(entitySelector), data = _d.data, error = _d.error;
17
+ var operationStartDate = (data.entityData.responseBody || {}).operationStartDate;
28
18
  var oDateControl = useController({ control: control, name: 'operationStartDate' });
19
+ var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
20
+ React.useEffect(function () {
21
+ if (!dateValue) {
22
+ var date = operationStartDate || new Date().toString();
23
+ setValue('operationStartDate', date, { shouldValidate: true });
24
+ }
25
+ }, [operationStartDate]);
29
26
  var handleOperationStartDateChange = function (data) {
30
27
  if (error)
31
28
  dispatch(clearError());
32
29
  oDateControl.field.onChange(data);
33
30
  };
34
- var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
35
- var storedDate = (_d = (_c = data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.business_operation_start_at;
36
- return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: !!storedDate ? (_jsx(Input, { label: t('business_start_date'), readOnly: true, value: dateValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } } })) : (_jsxs(_Fragment, { children: [_jsx(InputLabelStyled, { children: t('business_start_date') }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] })) })));
31
+ return (_jsx(ScreenContainer, { children: _jsxs(_Fragment, { children: [_jsx(InputLabelStyled, { children: t('business_start_date') }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] }) }));
37
32
  };
38
33
  export default OperationStartDate;
@@ -1,5 +1,8 @@
1
1
  import * as yup from 'yup';
2
2
  export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
3
6
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
7
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
8
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -16,25 +19,36 @@ export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/li
16
19
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
20
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
18
21
  }>>[] | 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>;
22
+ operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
23
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
24
+ articleFile: any;
25
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
26
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
27
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
28
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
29
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
30
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
31
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
32
  }>, 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>;
33
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
34
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
27
35
  }>>, 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>;
36
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
37
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
31
38
  }>>>, 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>;
39
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
40
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
41
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
42
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
43
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
35
44
  }>>[] | undefined>;
36
45
  operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
37
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
46
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
47
+ articleFile: any;
48
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
49
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
50
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
51
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
38
52
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
39
53
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
40
54
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -51,25 +65,37 @@ export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/li
51
65
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
52
66
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
53
67
  }>>[] | 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>;
68
+ operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
69
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
70
+ articleFile: any;
71
+ }>>>;
72
+ export declare const EntityInfoKWValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
73
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
74
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
75
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
76
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
77
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
78
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
58
79
  }>, 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>;
80
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
81
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
62
82
  }>>, 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>;
83
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
84
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
66
85
  }>>>, 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>;
86
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
87
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
88
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
89
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
90
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
70
91
  }>>[] | undefined>;
71
92
  operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
72
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
93
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
94
+ articleFile: any;
95
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
96
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
97
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
98
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
73
99
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
74
100
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
75
101
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -86,22 +112,30 @@ export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/li
86
112
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
87
113
  en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
88
114
  }>>[] | 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>;
115
+ operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
116
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
117
+ articleFile: any;
118
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
119
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
120
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
121
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
122
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
123
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
124
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
93
125
  }>, 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>;
126
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
127
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
97
128
  }>>, 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>;
129
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
130
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
101
131
  }>>>, 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>;
132
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
133
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
134
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
135
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
136
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
105
137
  }>>[] | undefined>;
106
138
  operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
139
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
140
+ articleFile: any;
107
141
  }>>>;
@@ -1,17 +1,83 @@
1
+ import { KW_MIN_LICENSE_LENGTH, MAX_FILE_SIZE, VALID_FILE_FORMATS, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH } from '../../../../constants';
2
+ import { BusinessType } from '../../../../@types';
1
3
  import * as yup from 'yup';
2
4
  export var EntityInfoValidationSchema = yup.object().shape({
5
+ licenseName: yup.string().required(''),
6
+ licenseType: yup.string().required(''),
7
+ licenseNumber: yup
8
+ .string()
9
+ .test({
10
+ test: function (value) {
11
+ var type = this.parent.licenseType;
12
+ var isCR = type === BusinessType.CR;
13
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
14
+ if (length === 0)
15
+ return true;
16
+ if (isCR) {
17
+ return length > CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
18
+ }
19
+ return length > FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
20
+ }
21
+ })
22
+ .required(''),
3
23
  activities: yup.array().of(yup.object().shape({
4
24
  ar: yup.string(),
5
25
  en: yup.string()
6
26
  })),
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
- operationStartDate: yup.string().required('choose_any_business_date')
27
+ operationStartDate: yup.string().required('choose_any_business_date'),
28
+ articleId: yup.string().optional(),
29
+ articleFile: yup
30
+ .mixed()
31
+ .test({
32
+ test: function (value) {
33
+ if (!!value)
34
+ return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE
35
+ ? true
36
+ : this.createError({ message: 'alert_file_upload' });
37
+ return true;
38
+ }
39
+ })
40
+ .optional()
41
+ });
42
+ export var EntityInfoKWValidationSchema = yup.object().shape({
43
+ licenseName: yup.string().required(''),
44
+ licenseType: yup.string().required(''),
45
+ licenseNumber: yup
46
+ .string()
47
+ .when('licenseType', function (licenseType) {
48
+ var isCR = licenseType === BusinessType.CR;
49
+ if (!isCR) {
50
+ return yup.string().optional();
51
+ }
52
+ return yup
53
+ .string()
54
+ .required('')
55
+ .test({
56
+ test: function (value) {
57
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
58
+ if (length === 0)
59
+ return true;
60
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
61
+ }
62
+ });
63
+ })
64
+ .required(''),
65
+ activities: yup.array().of(yup.object().shape({
66
+ ar: yup.string(),
67
+ en: yup.string()
68
+ })),
69
+ operationStartDate: yup.string().required('choose_any_business_date'),
70
+ articleId: yup.string().optional(),
71
+ articleFile: yup
72
+ .mixed()
73
+ .test({
74
+ test: function (value) {
75
+ if (!!value)
76
+ return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE
77
+ ? true
78
+ : this.createError({ message: 'alert_file_upload' });
79
+ return true;
80
+ }
81
+ })
82
+ .optional()
17
83
  });
@@ -7,10 +7,14 @@ import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var _b = useAppSelector(entitySelector), loading = _b.loading, error = _b.error;
11
- var onSuccess = function () {
10
+ var _b = useAppSelector(entitySelector), error = _b.error, loading = _b.loading;
11
+ var _c = React.useState(false), clicked = _c[0], setClicked = _c[1];
12
+ React.useEffect(function () {
12
13
  dispatch(updateBoardSuccess());
14
+ }, []);
15
+ var onSuccess = function () {
16
+ setClicked(true);
13
17
  };
14
- return (_jsx(SuccessScreen, { title: t('entity_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
18
+ return (_jsx(SuccessScreen, { title: t('entity_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: clicked && loading, error: error || '' }));
15
19
  };
16
20
  export default React.memo(Success);