@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
@@ -33,8 +33,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
33
33
  import * as React from 'react';
34
34
  import Box from '@mui/material/Box';
35
35
  import { alpha, styled } from '@mui/material/styles';
36
+ import InfoIcon from '@mui/icons-material/Info';
37
+ import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
36
38
  import Text from '../../../../components/Text';
37
39
  import Input from '../../../../components/Input';
40
+ import Tooltip from '../../../../components/Tooltip';
38
41
  import { useTranslation } from 'react-i18next';
39
42
  import { useController, useFormContext } from 'react-hook-form';
40
43
  import { useLanguage, useAppSelector } from '../../../../hooks';
@@ -45,10 +48,11 @@ import ExpandIcon from '../../../../components/ExpandIcon';
45
48
  import { ScreenContainer } from '../../../shared/Containers';
46
49
  import { businessSelector } from '../../../app/business/businessStore';
47
50
  import CheckIcon from '@mui/icons-material/Check';
48
- import { MandatoryStyled } from './SalesChannels';
51
+ import { MandatoryStyled } from './OperationStartDate';
52
+ import Search from '../../../../features/shared/Search';
49
53
  export var InputLabelStyled = styled(Text)(function (_a) {
50
54
  var theme = _a.theme;
51
- return (__assign({ margin: theme.spacing(2.5, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
55
+ return (__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
52
56
  });
53
57
  export var InputStyled = styled(Input)(function (_a) {
54
58
  var theme = _a.theme;
@@ -59,9 +63,33 @@ export var InputStyled = styled(Input)(function (_a) {
59
63
  }
60
64
  });
61
65
  });
62
- var SimpleListStyled = styled((SimpleList))(function () { return ({
63
- height: 'fit-content'
64
- }); });
66
+ export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
67
+ var theme = _a.theme;
68
+ return ({
69
+ width: theme.spacing(2.75),
70
+ height: theme.spacing(2.125),
71
+ cursor: 'pointer',
72
+ color: alpha(theme.palette.text.primary, 0.4)
73
+ });
74
+ });
75
+ export var InfoIconStyled = styled(InfoIcon)(function (_a) {
76
+ var theme = _a.theme;
77
+ return ({
78
+ width: theme.spacing(2.75),
79
+ height: theme.spacing(2.125),
80
+ cursor: 'pointer',
81
+ color: alpha(theme.palette.text.primary, 0.4)
82
+ });
83
+ });
84
+ export var LabelContainerStyled = styled(Box)(function (_a) {
85
+ var theme = _a.theme;
86
+ return ({
87
+ display: 'flex',
88
+ justifyContent: 'space-between',
89
+ margin: theme.spacing(2.5, 2.5, 1.5, 2.5)
90
+ });
91
+ });
92
+ var SimpleListStyled = styled((SimpleList))(function () { return ({}); });
65
93
  export var CheckIconStyled = styled(CheckIcon)(function (_a) {
66
94
  var theme = _a.theme;
67
95
  return ({
@@ -85,6 +113,7 @@ var ActivitiesList = function (_a) {
85
113
  var data = useAppSelector(businessSelector).data;
86
114
  var activitiesControl = useController({ name: 'activities', control: control });
87
115
  var controlValue = activitiesControl.field.value;
116
+ var _e = React.useState(false), isHovered = _e[0], setIsHovered = _e[1];
88
117
  var businessTypeData = data.businessTypeData;
89
118
  var activities = (businessTypeData.responseBody || {}).activities;
90
119
  var businessType = (_b = businessTypeData.selectedLicense) === null || _b === void 0 ? void 0 : _b.type;
@@ -105,9 +134,9 @@ var ActivitiesList = function (_a) {
105
134
  (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
106
135
  };
107
136
  var onSelectItem = function (item) {
108
- var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.en === (item === null || item === void 0 ? void 0 : item.en); });
137
+ var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === item.id; });
109
138
  if (isActivityExists) {
110
- var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.en !== (item === null || item === void 0 ? void 0 : item.en); });
139
+ var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.id !== (item === null || item === void 0 ? void 0 : item.id); });
111
140
  if (updatedIdList.length >= 1)
112
141
  activitiesControl.field.onChange(updatedIdList);
113
142
  return;
@@ -119,13 +148,23 @@ var ActivitiesList = function (_a) {
119
148
  if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) > 1) {
120
149
  return (controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) + ' ' + t('activities_selected');
121
150
  }
122
- return isAr ? (_a = controlValue[0]) === null || _a === void 0 ? void 0 : _a.ar : (_b = controlValue[0]) === null || _b === void 0 ? void 0 : _b.en;
151
+ var item = controlValue[0];
152
+ return isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en;
123
153
  };
124
154
  var getSelectedActivityFlag = function (item) {
125
- return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.en === (item === null || item === void 0 ? void 0 : item.en); });
155
+ return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === item.id; });
156
+ };
157
+ var handleSearch = function (value) {
158
+ var filteredList = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
159
+ var _a, _b, _c, _d;
160
+ return ((_b = (_a = activity === null || activity === void 0 ? void 0 : activity.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(value.toLowerCase())) ||
161
+ ((_d = (_c = activity === null || activity === void 0 ? void 0 : activity.name) === null || _c === void 0 ? void 0 : _c.ar) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes(value.toLowerCase()));
162
+ });
163
+ setActivitiesMenuList(filteredList);
126
164
  };
127
- return (_jsx(Collapse, __assign({ in: (activitiesMenuList === null || activitiesMenuList === void 0 ? void 0 : activitiesMenuList.length) > 0 }, { children: _jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t(isCR ? 'activities' : 'category'), " ", _jsx(MandatoryStyled, { children: "*" })] }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: getSelectedActivities(), placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: activitiesMenuList, onSelectItem: onSelectItem, renderItem: function (item) {
128
- return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.en) === getSelectedActivityFlag(item) }, { children: isAr ? item === null || item === void 0 ? void 0 : item.ar : item === null || item === void 0 ? void 0 : item.en })) })), getSelectedActivityFlag(item) && _jsx(CheckIconStyled, {})] }));
129
- } }) }))] })] }) })));
165
+ return (_jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsxs(InputLabelStyled, { children: [t(isCR ? 'activities' : 'category'), " ", _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Tooltip, __assign({ title: t('activities_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: getSelectedActivities(), placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name', list: activitiesMenuList, onSelectItem: onSelectItem, renderItem: function (item) {
166
+ var _a, _b, _c;
167
+ return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: item.id === ((_a = getSelectedActivityFlag(item)) === null || _a === void 0 ? void 0 : _a.id) }, { children: isAr ? (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = item === null || item === void 0 ? void 0 : item.name) === null || _c === void 0 ? void 0 : _c.en })) })), getSelectedActivityFlag(item) && _jsx(CheckIconStyled, {})] }));
168
+ } })] }))] })] }));
130
169
  };
131
170
  export default ActivitiesList;
@@ -1,4 +1,18 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
+ export declare const InputLabelStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
3
+ align?: "right" | "left" | "inherit" | "center" | "justify" | undefined;
4
+ children?: React.ReactNode;
5
+ classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
6
+ gutterBottom?: boolean | undefined;
7
+ noWrap?: boolean | undefined;
8
+ paragraph?: boolean | undefined;
9
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
10
+ variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2" | undefined;
11
+ variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2", string>> | undefined;
12
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
13
+ ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
14
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
15
+ export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
2
16
  export interface OperationStartDateProps {
3
17
  onDateClicked?: (flag: boolean) => void;
4
18
  }
@@ -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
  }>>>;
@@ -1,17 +1,11 @@
1
1
  import * as yup from 'yup';
2
2
  export var ActivitiesValidationSchema = yup.object().shape({
3
- activities: yup.array().of(yup.object().shape({
3
+ activities: yup
4
+ .array()
5
+ .min(1, 'activities_list_alert')
6
+ .of(yup.object().shape({
4
7
  ar: yup.string(),
5
8
  en: yup.string()
6
9
  })),
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
10
  operationStartDate: yup.string().required('choose_any_business_date')
17
11
  });
@@ -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;