@tap-payments/auth-jsconnect 2.0.51 → 2.0.52

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 (292) hide show
  1. package/build/@types/app.d.ts +90 -7
  2. package/build/@types/app.js +7 -0
  3. package/build/@types/form.d.ts +21 -20
  4. package/build/@types/theme.d.ts +1 -1
  5. package/build/api/account.d.ts +2 -2
  6. package/build/api/auth.d.ts +11 -11
  7. package/build/api/availabilityServices.d.ts +3 -3
  8. package/build/api/axios.js +1 -1
  9. package/build/api/board.d.ts +3 -3
  10. package/build/api/country.d.ts +1 -1
  11. package/build/api/data.d.ts +10 -10
  12. package/build/api/document.d.ts +2 -2
  13. package/build/api/entity.d.ts +12 -12
  14. package/build/api/file.d.ts +1 -1
  15. package/build/api/individual.d.ts +5 -5
  16. package/build/api/lead.d.ts +10 -10
  17. package/build/api/operator.d.ts +1 -1
  18. package/build/api/operator.js +1 -1
  19. package/build/api/user.d.ts +2 -2
  20. package/build/app/settings.d.ts +4 -11
  21. package/build/app/settings.js +13 -5
  22. package/build/app/store.d.ts +4 -4
  23. package/build/assets/locales/ar.json +3 -1
  24. package/build/assets/locales/en.json +3 -1
  25. package/build/components/DatePicker/DatePicker.js +1 -0
  26. package/build/components/RadioGroup/RadioGroup.d.ts +5 -2
  27. package/build/components/RadioGroup/RadioGroup.js +5 -9
  28. package/build/components/RadioGroup/index.d.ts +1 -1
  29. package/build/components/Slide/Slide.d.ts +1 -1
  30. package/build/constants/app.d.ts +3 -2
  31. package/build/constants/app.js +1 -0
  32. package/build/constants/validation.d.ts +1 -0
  33. package/build/constants/validation.js +1 -0
  34. package/build/features/app/bank/bankStore.d.ts +9 -73
  35. package/build/features/app/bank/bankStore.js +68 -91
  36. package/build/features/app/brand/brandStore.d.ts +16 -103
  37. package/build/features/app/brand/brandStore.js +62 -49
  38. package/build/features/app/business/businessStore.d.ts +18 -162
  39. package/build/features/app/business/businessStore.js +4 -3
  40. package/build/features/app/connect/connectStore.d.ts +13 -121
  41. package/build/features/app/connect/connectStore.js +5 -4
  42. package/build/features/app/connectExpress/connectExpressStore.d.ts +22 -211
  43. package/build/features/app/connectExpress/connectExpressStore.js +9 -10
  44. package/build/features/app/entity/entityStore.d.ts +9 -74
  45. package/build/features/app/entity/entityStore.js +129 -152
  46. package/build/features/app/individual/individualStore.d.ts +21 -167
  47. package/build/features/app/individual/individualStore.js +176 -202
  48. package/build/features/app/password/passwordStore.d.ts +12 -102
  49. package/build/features/app/password/passwordStore.js +1 -1
  50. package/build/features/app/signIn/signInStore.d.ts +7 -61
  51. package/build/features/app/signIn/signInStore.js +1 -1
  52. package/build/features/app/tax/taxStore.d.ts +8 -62
  53. package/build/features/app/tax/taxStore.js +48 -62
  54. package/build/features/bank/screens/BankDetails/BankDetails.js +20 -5
  55. package/build/features/bank/screens/BankDetails/BankName.d.ts +4 -1
  56. package/build/features/bank/screens/BankDetails/BankName.js +8 -7
  57. package/build/features/bank/screens/BankDetails/BankStatement.d.ts +5 -2
  58. package/build/features/bank/screens/BankDetails/BankStatement.js +3 -8
  59. package/build/features/bank/screens/BankDetails/Beneficiary.d.ts +2 -1
  60. package/build/features/bank/screens/BankDetails/Beneficiary.js +8 -7
  61. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +4 -1
  62. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +12 -13
  63. package/build/features/bank/screens/BankDetails/IBAN.d.ts +2 -1
  64. package/build/features/bank/screens/BankDetails/IBAN.js +3 -3
  65. package/build/features/bank/screens/BankDetails/validation.d.ts +14 -14
  66. package/build/features/bank/screens/BankDetails/validation.js +16 -21
  67. package/build/features/bank/screens/Verify/OTPInput.js +5 -3
  68. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +15 -18
  69. package/build/features/brand/screens/BrandActivities/ActivitiesList.js +14 -9
  70. package/build/features/brand/screens/BrandActivities/BrandActivities.js +14 -5
  71. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +12 -16
  72. package/build/features/brand/screens/BrandActivities/CustomerBase.js +16 -13
  73. package/build/features/brand/screens/BrandActivities/ExpectedCustomers.d.ts +2 -1
  74. package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +22 -9
  75. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.d.ts +2 -1
  76. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +20 -7
  77. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +13 -6
  78. package/build/features/brand/screens/BrandActivities/RefundPolicy.js +23 -12
  79. package/build/features/brand/screens/BrandActivities/TAC.d.ts +14 -1
  80. package/build/features/brand/screens/BrandActivities/TAC.js +21 -12
  81. package/build/features/brand/screens/BrandActivities/TransactionPolicy.d.ts +4 -1
  82. package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +18 -4
  83. package/build/features/brand/screens/BrandActivities/validation.d.ts +7 -7
  84. package/build/features/brand/screens/BrandActivities/validation.js +10 -19
  85. package/build/features/brand/screens/BrandInfo/BrandInfo.js +20 -12
  86. package/build/features/brand/screens/BrandInfo/BrandLogo.d.ts +9 -0
  87. package/build/features/brand/screens/BrandInfo/BrandLogo.js +52 -0
  88. package/build/features/brand/screens/BrandInfo/BrandName.d.ts +2 -1
  89. package/build/features/brand/screens/BrandInfo/BrandName.js +3 -3
  90. package/build/features/brand/screens/BrandInfo/SalesChannels.d.ts +2 -1
  91. package/build/features/brand/screens/BrandInfo/SalesChannels.js +2 -1
  92. package/build/features/brand/screens/BrandInfo/Segments.d.ts +2 -1
  93. package/build/features/brand/screens/BrandInfo/Segments.js +12 -2
  94. package/build/features/brand/screens/BrandInfo/TeamSize.d.ts +2 -1
  95. package/build/features/brand/screens/BrandInfo/TeamSize.js +12 -2
  96. package/build/features/brand/screens/BrandInfo/validation.d.ts +6 -6
  97. package/build/features/brand/screens/BrandInfo/validation.js +36 -42
  98. package/build/features/brand/screens/Verify/OTPInput.js +5 -3
  99. package/build/features/business/screens/Activities/ActivitiesList.d.ts +12 -17
  100. package/build/features/business/screens/Activities/ActivitiesList.js +5 -5
  101. package/build/features/business/screens/Activities/OperationStartDate.d.ts +2 -2
  102. package/build/features/business/screens/Activities/OperationStartDate.js +2 -2
  103. package/build/features/business/screens/BusinessType/Article.d.ts +1 -1
  104. package/build/features/business/screens/BusinessType/LicenseList.js +1 -1
  105. package/build/features/business/screens/BusinessType/LicenseType.d.ts +5 -5
  106. package/build/features/business/screens/Customers/CustomerLocations.d.ts +10 -15
  107. package/build/features/business/screens/Customers/CustomerLocations.js +5 -5
  108. package/build/features/business/screens/Customers/ExpectedCustomers.js +12 -2
  109. package/build/features/business/screens/Customers/ExpectedSalesRange.js +12 -2
  110. package/build/features/business/screens/Customers/RefundPolicy.d.ts +5 -5
  111. package/build/features/business/screens/IDBOD/DOB.js +1 -1
  112. package/build/features/business/screens/Verify/OTPInput.js +5 -3
  113. package/build/features/connect/screens/Individual/Email.js +1 -1
  114. package/build/features/connect/screens/Merchant/BrandList.js +1 -1
  115. package/build/features/connect/screens/Merchant/BrandName.js +1 -1
  116. package/build/features/connect/screens/Merchant/Segments.js +6 -1
  117. package/build/features/connect/screens/Merchant/TeamSize.js +6 -1
  118. package/build/features/connect/screens/Merchant/validation.js +5 -5
  119. package/build/features/connectExpress/screens/Brand/Brand.js +1 -1
  120. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.d.ts +2 -1
  121. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +3 -3
  122. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +5 -3
  123. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.d.ts +2 -1
  124. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +7 -5
  125. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.d.ts +1 -1
  126. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +1 -1
  127. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +7 -6
  128. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.js +4 -2
  129. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +14 -1
  130. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +9 -10
  131. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +9 -5
  132. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.d.ts +2 -1
  133. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +3 -3
  134. package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.d.ts +1 -0
  135. package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +6 -2
  136. package/build/features/connectExpress/screens/CollectIndividualInfo/Name.d.ts +2 -1
  137. package/build/features/connectExpress/screens/CollectIndividualInfo/Name.js +2 -2
  138. package/build/features/connectExpress/screens/Mobile/Mobile.js +4 -2
  139. package/build/features/connectExpress/screens/Mobile/MobileNumber.d.ts +1 -0
  140. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -2
  141. package/build/features/connectExpress/screens/Mobile/TAC.d.ts +2 -1
  142. package/build/features/connectExpress/screens/Mobile/TAC.js +3 -1
  143. package/build/features/connectExpress/screens/NID/DOB.d.ts +2 -1
  144. package/build/features/connectExpress/screens/NID/DOB.js +2 -2
  145. package/build/features/connectExpress/screens/NID/IDNumber.d.ts +1 -0
  146. package/build/features/connectExpress/screens/NID/IDNumber.js +2 -2
  147. package/build/features/connectExpress/screens/NID/NID.js +4 -2
  148. package/build/features/connectExpress/screens/NID/TAC.d.ts +14 -1
  149. package/build/features/connectExpress/screens/NID/TAC.js +9 -10
  150. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +14 -18
  151. package/build/features/entity/screens/EntityCapital/ActivityList.js +20 -27
  152. package/build/features/entity/screens/EntityCapital/CapitalPaid.d.ts +2 -1
  153. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +7 -3
  154. package/build/features/entity/screens/EntityCapital/CapitalShareCount.d.ts +2 -1
  155. package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +7 -3
  156. package/build/features/entity/screens/EntityCapital/CapitalShareValue.d.ts +2 -1
  157. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +7 -3
  158. package/build/features/entity/screens/EntityCapital/EntityCapital.js +19 -17
  159. package/build/features/entity/screens/EntityCapital/validation.d.ts +10 -10
  160. package/build/features/entity/screens/EntityCapital/validation.js +4 -10
  161. package/build/features/entity/screens/EntityName/Article.d.ts +5 -2
  162. package/build/features/entity/screens/EntityName/Article.js +9 -6
  163. package/build/features/entity/screens/EntityName/EntityName.js +20 -5
  164. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +14 -18
  165. package/build/features/entity/screens/EntityName/EntityTypeList.js +24 -27
  166. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +4 -3
  167. package/build/features/entity/screens/EntityName/ExpiryDate.js +2 -2
  168. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +4 -3
  169. package/build/features/entity/screens/EntityName/IssuingDate.js +2 -2
  170. package/build/features/entity/screens/EntityName/LegalName.d.ts +2 -1
  171. package/build/features/entity/screens/EntityName/LegalName.js +8 -4
  172. package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +4 -1
  173. package/build/features/entity/screens/EntityName/LicenseCertificate.js +8 -9
  174. package/build/features/entity/screens/EntityName/LicenseNumber.d.ts +2 -1
  175. package/build/features/entity/screens/EntityName/LicenseNumber.js +8 -5
  176. package/build/features/entity/screens/EntityName/UnifiedNumber.d.ts +2 -1
  177. package/build/features/entity/screens/EntityName/UnifiedNumber.js +8 -5
  178. package/build/features/entity/screens/EntityName/validation.d.ts +35 -35
  179. package/build/features/entity/screens/EntityName/validation.js +68 -93
  180. package/build/features/entity/screens/Verify/OTPInput.js +5 -3
  181. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +2 -2
  182. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +25 -6
  183. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.d.ts +7 -1
  184. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +21 -9
  185. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.d.ts +2 -1
  186. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +8 -6
  187. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +2 -1
  188. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +25 -25
  189. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +2 -1
  190. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +25 -25
  191. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +6 -5
  192. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +8 -6
  193. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +2 -1
  194. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +8 -2
  195. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +2 -1
  196. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +8 -3
  197. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.d.ts +4 -1
  198. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +8 -9
  199. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +2 -1
  200. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +25 -25
  201. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +2 -2
  202. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +6 -11
  203. package/build/features/individual/screens/IndividualList/Email.js +1 -1
  204. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +4 -4
  205. package/build/features/individual/screens/IndividualList/MobileNumber.js +0 -1
  206. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +1 -0
  207. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +12 -2
  208. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +1 -0
  209. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +12 -2
  210. package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +2 -1
  211. package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +3 -3
  212. package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +2 -1
  213. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -4
  214. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +2 -1
  215. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +4 -5
  216. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +7 -6
  217. package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +4 -2
  218. package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +2 -1
  219. package/build/features/individual/screens/IndividualPersonalInfo/ID.js +2 -7
  220. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +2 -2
  221. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +20 -4
  222. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +1 -0
  223. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +13 -7
  224. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +1 -0
  225. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +11 -10
  226. package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +2 -1
  227. package/build/features/individual/screens/IndividualPersonalInfo/Name.js +2 -2
  228. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +1 -0
  229. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +13 -7
  230. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.d.ts +1 -0
  231. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +6 -3
  232. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +4 -2
  233. package/build/features/individual/screens/Verify/OTPInput.js +5 -3
  234. package/build/features/password/screens/Verify/OTPInput.js +5 -3
  235. package/build/features/shared/Address/CountryList.d.ts +9 -9
  236. package/build/features/shared/Address/CountryList.js +1 -1
  237. package/build/features/shared/Address/InputSelect.d.ts +9 -9
  238. package/build/features/shared/Address/InputSelect.js +2 -2
  239. package/build/features/shared/Button/EmailProvidersButtons.d.ts +1 -1
  240. package/build/features/shared/Button/FlowsButtons.d.ts +1 -1
  241. package/build/features/shared/Button/FlowsButtons.js +15 -20
  242. package/build/features/shared/Button/IndividualActionButtons.d.ts +1 -1
  243. package/build/features/shared/Containers/FeatureContainer.d.ts +1 -1
  244. package/build/features/shared/Containers/ScreenContainer.d.ts +1 -1
  245. package/build/features/shared/GenericError/GenericError.js +1 -1
  246. package/build/features/shared/Input/Input.d.ts +3 -3
  247. package/build/features/shared/Input/Input.js +2 -3
  248. package/build/features/shared/OTP/OTP.d.ts +2 -1
  249. package/build/features/shared/OTP/OTP.js +2 -2
  250. package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +2 -1
  251. package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +5 -4
  252. package/build/features/shared/SalesChannels/SalesChannel.d.ts +2 -1
  253. package/build/features/shared/SalesChannels/SalesChannel.js +5 -4
  254. package/build/features/shared/UploadFile/FileUpload.d.ts +6 -4
  255. package/build/features/shared/UploadFile/FileUpload.js +19 -15
  256. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -2
  257. package/build/features/shared/UploadFile/UploadFile.js +7 -7
  258. package/build/features/shared/UploadFile/UploadWrapper.d.ts +5 -3
  259. package/build/features/shared/UploadFile/UploadWrapper.js +3 -2
  260. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +5 -4
  261. package/build/features/shared/UploadMultipleFile/UploadFile.js +14 -10
  262. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +4 -3
  263. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +3 -3
  264. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +4 -1
  265. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +12 -12
  266. package/build/features/tax/screens/TaxDetails/TaxDetails.js +9 -4
  267. package/build/features/tax/screens/TaxDetails/TaxDocument.d.ts +4 -1
  268. package/build/features/tax/screens/TaxDetails/TaxDocument.js +3 -8
  269. package/build/features/tax/screens/TaxDetails/VATId.d.ts +4 -1
  270. package/build/features/tax/screens/TaxDetails/VATId.js +5 -7
  271. package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
  272. package/build/features/tax/screens/TaxDetails/validation.js +2 -5
  273. package/build/features/tax/screens/Verify/OTPInput.js +5 -3
  274. package/build/hooks/index.d.ts +3 -0
  275. package/build/hooks/index.js +3 -0
  276. package/build/hooks/useAppConfig.d.ts +1 -1
  277. package/build/hooks/useAppConfig.js +4 -2
  278. package/build/hooks/useDataNoneEditable.d.ts +2 -0
  279. package/build/hooks/useDataNoneEditable.js +19 -0
  280. package/build/hooks/useFormErrorAndUpdateReadOnly.d.ts +6 -0
  281. package/build/hooks/useFormErrorAndUpdateReadOnly.js +48 -0
  282. package/build/hooks/useFormReadOnly.d.ts +6 -0
  283. package/build/hooks/useFormReadOnly.js +40 -0
  284. package/build/utils/error.d.ts +1 -0
  285. package/build/utils/error.js +3 -0
  286. package/build/utils/object.d.ts +4 -0
  287. package/build/utils/object.js +17 -0
  288. package/build/utils/string.d.ts +1 -1
  289. package/build/utils/string.js +13 -7
  290. package/package.json +2 -2
  291. package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +0 -20
  292. package/build/features/brand/screens/BrandActivities/OperationStartDate.js +0 -45
@@ -1,79 +1,76 @@
1
1
  import * as yup from 'yup';
2
- import { BusinessType, FieldType } from '../../../../@types';
2
+ import { BusinessType } from '../../../../@types';
3
3
  import { KW_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH } from '../../../../constants';
4
- export var EntityNameValidationSchema = function (entity) {
5
- var _a, _b, _c, _d, _e;
6
- var _f = entity || {}, legal_name = _f.legal_name, data_status = _f.data_status, license = _f.license;
7
- var isLegalNameOptional = !((legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar) || (legal_name === null || legal_name === void 0 ? void 0 : legal_name.en)) && (data_status === null || data_status === void 0 ? void 0 : data_status.legal_name) === FieldType.NON_EDITABLE;
8
- var isEntityTypeOptional = !(license === null || license === void 0 ? void 0 : license.type) && (data_status === null || data_status === void 0 ? void 0 : data_status.type) === FieldType.NON_EDITABLE;
9
- var isLicenseNumberOptional = !(license === null || license === void 0 ? void 0 : license.number) && ((_a = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _a === void 0 ? void 0 : _a.number) === FieldType.NON_EDITABLE;
10
- var isUnifiedNumberOptional = !((_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) && ((_c = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _c === void 0 ? void 0 : _c.additional_info) === FieldType.NON_EDITABLE;
11
- var isIssuingDateOptional = !(license === null || license === void 0 ? void 0 : license.issuing_date) && ((_d = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _d === void 0 ? void 0 : _d.issuing_date) === FieldType.NON_EDITABLE;
12
- var isExpiryDateOptional = !(license === null || license === void 0 ? void 0 : license.expiry_date) && ((_e = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _e === void 0 ? void 0 : _e.expiry_date) === FieldType.NON_EDITABLE;
4
+ export var EntityNameValidationSchema = function () {
13
5
  return yup.object().shape({
14
- legalName: isLegalNameOptional
15
- ? yup.string().optional()
16
- : yup
17
- .string()
18
- .required('')
19
- .test({
20
- test: function (value) {
21
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
22
- if (length === 0)
23
- return true;
24
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
25
- }
26
- }),
6
+ legalName: yup
7
+ .string()
8
+ .required('')
9
+ .test({
10
+ test: function (value) {
11
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
12
+ if (length === 0)
13
+ return true;
14
+ return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
15
+ }
16
+ }),
27
17
  licenseType: yup.string().optional(),
28
- entityType: isEntityTypeOptional ? yup.string().optional() : yup.string().required('entity_type_required'),
29
- licenseNumber: isLicenseNumberOptional
30
- ? yup.string().optional()
31
- : yup
32
- .string()
33
- .test({
34
- test: function (value) {
35
- var type = this.parent.licenseType;
36
- var isCR = type === BusinessType.CR;
37
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
38
- if (length === 0)
39
- return true;
40
- if (isCR) {
41
- return length > CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
42
- }
43
- return length > FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
44
- }
45
- })
46
- .required(''),
47
- unifiedNumber: isUnifiedNumberOptional
48
- ? yup.string().optional()
49
- : yup
50
- .string()
51
- .when('licenseType', function (licenseType) {
52
- var isCR = licenseType === BusinessType.CR;
18
+ entityType: yup.string().required('entity_type_required'),
19
+ licenseNumber: yup
20
+ .string()
21
+ .test({
22
+ test: function (value) {
23
+ var type = this.parent.licenseType;
24
+ var isCR = type === BusinessType.CR;
25
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
26
+ if (length === 0)
27
+ return true;
53
28
  if (isCR) {
54
- return yup.string().required('unified_number_required');
29
+ return length > CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
55
30
  }
56
- return yup.string().optional();
57
- })
58
- .required(''),
59
- issuingDate: isIssuingDateOptional ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
60
- expiryDate: isExpiryDateOptional ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
31
+ return length > FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
32
+ }
33
+ })
34
+ .required(''),
35
+ unifiedNumber: yup
36
+ .string()
37
+ .when('licenseType', function (licenseType) {
38
+ var isCR = licenseType === BusinessType.CR;
39
+ if (isCR) {
40
+ return yup.string().required('unified_number_required');
41
+ }
42
+ return yup.string().optional();
43
+ })
44
+ .required(''),
45
+ issuingDate: yup.string().required('choose_any_issuing_date'),
46
+ expiryDate: yup.string().required('choose_any_expiry_date'),
61
47
  certificateId: yup.array().optional(),
62
48
  articleId: yup.string().optional()
63
49
  });
64
50
  };
65
- export var EntityNameKWValidationSchema = function (entity) {
66
- var _a, _b, _c;
67
- var _d = entity || {}, legal_name = _d.legal_name, data_status = _d.data_status, license = _d.license;
68
- var isLegalNameOptional = !((legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar) || (legal_name === null || legal_name === void 0 ? void 0 : legal_name.en)) && (data_status === null || data_status === void 0 ? void 0 : data_status.legal_name) === FieldType.NON_EDITABLE;
69
- var isEntityTypeOptional = !(license === null || license === void 0 ? void 0 : license.type) && (data_status === null || data_status === void 0 ? void 0 : data_status.type) === FieldType.NON_EDITABLE;
70
- var isLicenseNumberOptional = !(license === null || license === void 0 ? void 0 : license.number) && ((_a = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _a === void 0 ? void 0 : _a.number) === FieldType.NON_EDITABLE;
71
- var isIssuingDateOptional = !(license === null || license === void 0 ? void 0 : license.issuing_date) && ((_b = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _b === void 0 ? void 0 : _b.issuing_date) === FieldType.NON_EDITABLE;
72
- var isExpiryDateOptional = !(license === null || license === void 0 ? void 0 : license.expiry_date) && ((_c = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _c === void 0 ? void 0 : _c.expiry_date) === FieldType.NON_EDITABLE;
51
+ export var EntityNameKWValidationSchema = function () {
73
52
  return yup.object().shape({
74
- legalName: isLegalNameOptional
75
- ? yup.string().optional()
76
- : yup
53
+ legalName: yup
54
+ .string()
55
+ .required('')
56
+ .test({
57
+ test: function (value) {
58
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
59
+ if (length === 0)
60
+ return true;
61
+ return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
62
+ }
63
+ }),
64
+ licenseType: yup.string().optional(),
65
+ entityType: yup.string().required('entity_type_required'),
66
+ licenseNumber: yup
67
+ .string()
68
+ .when('licenseType', function (licenseType) {
69
+ var isCR = licenseType === BusinessType.CR;
70
+ if (!isCR) {
71
+ return yup.string().optional();
72
+ }
73
+ return yup
77
74
  .string()
78
75
  .required('')
79
76
  .test({
@@ -81,35 +78,13 @@ export var EntityNameKWValidationSchema = function (entity) {
81
78
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
82
79
  if (length === 0)
83
80
  return true;
84
- return length >= 3 ? true : this.createError({ message: 'enter_legal_name_min_three_chars' });
85
- }
86
- }),
87
- licenseType: yup.string().optional(),
88
- entityType: isEntityTypeOptional ? yup.string().optional() : yup.string().required('entity_type_required'),
89
- licenseNumber: isLicenseNumberOptional
90
- ? yup.string().optional()
91
- : yup
92
- .string()
93
- .when('licenseType', function (licenseType) {
94
- var isCR = licenseType === BusinessType.CR;
95
- if (!isCR) {
96
- return yup.string().optional();
81
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
97
82
  }
98
- return yup
99
- .string()
100
- .required('')
101
- .test({
102
- test: function (value) {
103
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
104
- if (length === 0)
105
- return true;
106
- return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
107
- }
108
- });
109
- })
110
- .required(''),
111
- issuingDate: isIssuingDateOptional ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
112
- expiryDate: isExpiryDateOptional ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
83
+ });
84
+ })
85
+ .required(''),
86
+ issuingDate: yup.string().required('choose_any_issuing_date'),
87
+ expiryDate: yup.string().required('choose_any_expiry_date'),
113
88
  certificateId: yup.array().optional(),
114
89
  articleId: yup.string().optional()
115
90
  });
@@ -17,8 +17,9 @@ import OTPField from '../../../shared/OTP';
17
17
  import { useController, useFormContext } from 'react-hook-form';
18
18
  import { useTranslation } from 'react-i18next';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { useAppDispatch } from '../../../../hooks';
21
- import { resendOTP } from '../../../app/entity/entityStore';
20
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
21
+ import { isTokenExpired } from '../../../../utils';
22
+ import { entitySelector, resendOTP } from '../../../app/entity/entityStore';
22
23
  var BoxStyled = styled(Box)(function (_a) {
23
24
  var theme = _a.theme;
24
25
  return ({
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
33
34
  var t = useTranslation().t;
34
35
  var otpControl = useController({ name: 'otp', control: control });
35
36
  var dispatch = useAppDispatch();
37
+ var error = useAppSelector(entitySelector).error;
36
38
  var handleOnOTPChange = function (otp) {
37
39
  otpControl.field.onChange(otp);
38
40
  };
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
42
44
  dispatch(resendOTP());
43
45
  };
44
46
  var otpValue = otpControl.field.value;
45
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
47
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
46
48
  };
47
49
  export default React.memo(OTPInput);
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export declare const RoleTextStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
3
- align?: "right" | "left" | "center" | "inherit" | "justify" | undefined;
3
+ align?: "right" | "left" | "inherit" | "center" | "justify" | undefined;
4
4
  children?: React.ReactNode;
5
5
  classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
6
6
  gutterBottom?: boolean | undefined;
@@ -11,7 +11,7 @@ export declare const RoleTextStyled: import("@emotion/styled").StyledComponent<i
11
11
  variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2", string>> | undefined;
12
12
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
13
13
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
14
- }, ("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" | keyof import("@mui/material/OverridableComponent").CommonProps | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
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
15
  export interface AdditionalIndividualInfoProps {
16
16
  }
17
17
  declare const _default: React.MemoExoticComponent<{
@@ -14,11 +14,12 @@ import * as React from 'react';
14
14
  import { yupResolver } from '@hookform/resolvers/yup';
15
15
  import { useForm, FormProvider } from 'react-hook-form';
16
16
  import { useTranslation } from 'react-i18next';
17
- import { handleCurrentActiveScreen } from '../../../../app/settings';
17
+ import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
18
18
  import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
- import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage } from '../../../../hooks';
21
- import { IndividualType } from '../../../../@types';
20
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
21
+ import { DocumentPurpose, IndividualType } from '../../../../@types';
22
+ import { isSA } from '../../../../utils';
22
23
  import Form from '../../../../components/Form';
23
24
  import Collapse from '../../../../components/Collapse';
24
25
  import Text from '../../../../components/Text';
@@ -35,6 +36,7 @@ import CivilIDFile from './CivilIDFile';
35
36
  import SignatureFile from './SignatureFile';
36
37
  import ShareCount from './ShareCount';
37
38
  import ShareValue from './ShareValue';
39
+ import { getFileDetailsFromDocument } from '../../../../utils';
38
40
  var TextBoxStyled = styled(Box)(function (_a) {
39
41
  var theme = _a.theme;
40
42
  return (__assign(__assign({ display: 'flex', justifyContent: 'center', flexDirection: 'row', padding: theme.spacing(1.8, 2.5, 1.8, 2.5) }, theme.typography.body1), { lineHeight: theme.spacing(2.5), color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium }));
@@ -54,12 +56,12 @@ var AdditionalIndividualInfo = function (_a) {
54
56
  var isAr = useLanguage().isAr;
55
57
  var dispatch = useAppDispatch();
56
58
  var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
59
+ var settingsData = useAppSelector(settingsSelector).data;
57
60
  var verify = data.verify;
58
61
  var user = (verify.responseBody || {}).user;
59
- var isAuthorizedUser = user === null || user === void 0 ? void 0 : user.is_authorized;
60
62
  var _c = data.individualData, occupation = _c.occupation, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, employerName = _c.employerName, employerLocation = _c.employerLocation, isPEP = _c.isPEP, isInfluencer = _c.isInfluencer, civilID = _c.civilID, signatureFileId = _c.signatureFileId, civilIDUploading = _c.civilIDUploading, signatureFileUploading = _c.signatureFileUploading, shareCount = _c.shareCount, shareValue = _c.shareValue;
61
63
  var methods = useForm({
62
- resolver: yupResolver(IndividualInfoValidationSchema(isAuthorizedUser, user)),
64
+ resolver: yupResolver(IndividualInfoValidationSchema(user === null || user === void 0 ? void 0 : user.type)),
63
65
  defaultValues: {
64
66
  occupation: occupation,
65
67
  sourceIncome: sourceIncome,
@@ -79,6 +81,7 @@ var AdditionalIndividualInfo = function (_a) {
79
81
  });
80
82
  useSetFromDefaultValues(methods, data.individualData, true);
81
83
  var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
84
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
82
85
  var onSubmit = function (data) {
83
86
  dispatch(updateIndividualInfo(data));
84
87
  };
@@ -103,6 +106,22 @@ var AdditionalIndividualInfo = function (_a) {
103
106
  return t('type_board_member');
104
107
  return t('type_user');
105
108
  };
109
+ var defaultCivilIdFiles = React.useMemo(function () { return getFileDetailsFromDocument(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT); }, [user === null || user === void 0 ? void 0 : user.documents]);
110
+ var defaultSignatureFiles = React.useMemo(function () { return getFileDetailsFromDocument(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE); }, [user === null || user === void 0 ? void 0 : user.documents]);
111
+ var originalReadOnly = useFormReadOnly(methods, {
112
+ isPEP: typeof isPEP === 'boolean',
113
+ isInfluencer: typeof isInfluencer === 'boolean',
114
+ civilID: defaultCivilIdFiles,
115
+ signatureFileId: defaultSignatureFiles
116
+ });
117
+ var noneEditable = useDataNoneEditable(user === null || user === void 0 ? void 0 : user.data_status, [
118
+ 'occupation',
119
+ 'source_of_income',
120
+ 'monthly_income',
121
+ 'is_relative_PEP',
122
+ 'is_influencer'
123
+ ]);
124
+ var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
106
125
  var showSignatureFile = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
107
126
  var showOccupationFile = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
108
127
  var showSourceOfIncome = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
@@ -113,7 +132,7 @@ var AdditionalIndividualInfo = function (_a) {
113
132
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
114
133
  var isOccupationListActive = listActive === ListType.OccupationList;
115
134
  var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
116
- return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares }), _jsx(ShareValue, { show: !listActive && showShares }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: (user === null || user === void 0 ? void 0 : user.is_authorized) && showSignatureFile })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
135
+ return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { readOnly: readOnly['occupation'] || noneEditable['occupation'], onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { readOnly: readOnly['sourceIncome'] || noneEditable['source_of_income'], onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { readOnly: readOnly['monthlyIncome'] || noneEditable['monthly_income'], show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares, readOnly: readOnly['shareCount'] }), _jsx(ShareValue, { show: !listActive && showShares, readOnly: readOnly['shareValue'] }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: !isSACountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show: (user === null || user === void 0 ? void 0 : user.is_authorized) && showSignatureFile, readOnly: readOnly['signatureFileId'], defaultFiles: defaultSignatureFiles })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive, readOnly: readOnly['isPEP'] || noneEditable['is_relative_PEP'] }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !listActive, readOnly: readOnly['isInfluencer'] || noneEditable['is_influencer'] })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
117
136
  };
118
137
  export default React.memo(AdditionalIndividualInfo);
119
138
  AdditionalIndividualInfo.defaultProps = {};
@@ -1,3 +1,9 @@
1
1
  /// <reference types="react" />
2
- declare const CivilIDFile: () => JSX.Element;
2
+ import { FileDetails } from '../../../../@types';
3
+ declare type CivilIDFileProps = {
4
+ defaultFiles?: Array<FileDetails>;
5
+ readOnly?: boolean;
6
+ show: boolean;
7
+ };
8
+ declare const CivilIDFile: ({ defaultFiles, readOnly, show }: CivilIDFileProps) => JSX.Element;
3
9
  export default CivilIDFile;
@@ -1,5 +1,15 @@
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 } from "react/jsx-runtime";
2
- import React from 'react';
3
13
  import { ScreenContainer } from '../../../../features/shared/Containers';
4
14
  import { styled } from '@mui/material/styles';
5
15
  import { useTranslation } from 'react-i18next';
@@ -7,8 +17,8 @@ import { useController, useFormContext } from 'react-hook-form';
7
17
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
18
  import { DocumentPurpose } from '../../../../@types';
9
19
  import { FileType } from '../../../../constants';
10
- import { getFileDetailsFromDocument } from '../../../../utils';
11
- import { civilIDUploadingStatus, individualSelector } from '../../../app/individual/individualStore';
20
+ import Collapse from '../../../../components/Collapse';
21
+ import { civilIDUploadingStatus, clearError, individualSelector } from '../../../app/individual/individualStore';
12
22
  import UploadMultipleFile from '../../../shared/UploadMultipleFile';
13
23
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
14
24
  var theme = _a.theme;
@@ -16,21 +26,23 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
16
26
  marginBlockStart: theme.spacing(3)
17
27
  });
18
28
  });
19
- var CivilIDFile = function () {
20
- var _a;
29
+ var CivilIDFile = function (_a) {
30
+ var defaultFiles = _a.defaultFiles, readOnly = _a.readOnly, show = _a.show;
21
31
  var t = useTranslation().t;
22
32
  var dispatch = useAppDispatch();
23
33
  var control = useFormContext().control;
24
34
  var civilIDFileIdControl = useController({ name: 'civilID', control: control });
25
- var _b = useAppSelector(individualSelector), loading = _b.loading, data = _b.data;
26
- var documents = (((_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}).documents;
35
+ var _b = useAppSelector(individualSelector), loading = _b.loading, error = _b.error;
27
36
  var handleCivilIDChange = function (ids) {
37
+ if (error)
38
+ dispatch(clearError());
28
39
  civilIDFileIdControl.field.onChange(ids);
29
40
  };
30
41
  var handleReset = function (ids) {
42
+ if (error)
43
+ dispatch(clearError());
31
44
  civilIDFileIdControl.field.onChange(ids);
32
45
  };
33
- var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.IDENTITY_DOCUMENT); }, [documents]);
34
- return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'civilID', control: control, label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }));
46
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'civilID', control: control, label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }) })));
35
47
  };
36
48
  export default CivilIDFile;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export interface InfluencerSwitchProps {
3
3
  show: boolean;
4
+ readOnly?: boolean;
4
5
  }
5
- declare const _default: React.MemoExoticComponent<({ show }: InfluencerSwitchProps) => JSX.Element>;
6
+ declare const _default: React.MemoExoticComponent<({ show, readOnly }: InfluencerSwitchProps) => JSX.Element>;
6
7
  export default _default;
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useFormContext, useController } from 'react-hook-form';
16
16
  import { ScreenContainer } from '../../../shared/Containers';
17
17
  import Collapse from '../../../../components/Collapse';
18
- import { useAppSelector } from '../../../../hooks';
18
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import { styled, alpha } from '@mui/material/styles';
20
20
  import Mandatory from '../../../shared/Mandatory';
21
21
  import Text from '../../../../components/Text';
@@ -24,7 +24,7 @@ import RadioLabel from '../../../../components/RadioLabel';
24
24
  import { InfoIconStyled, InfoOutlinedIconStyled } from './PEPSwitch';
25
25
  import Box from '@mui/material/Box';
26
26
  import Tooltip from '../../../../components/Tooltip';
27
- import { individualSelector } from '../../../app/individual/individualStore';
27
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
28
28
  var LabelTextStyled = styled(Text)(function (_a) {
29
29
  var theme = _a.theme;
30
30
  return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
@@ -36,19 +36,21 @@ var RadioGroupStyled = styled(RadioGroup)(function (_a) {
36
36
  });
37
37
  });
38
38
  var InfluencerSwitch = function (_a) {
39
- var show = _a.show;
39
+ var show = _a.show, readOnly = _a.readOnly;
40
40
  var _b = React.useState(false), isHovered = _b[0], setIsHovered = _b[1];
41
41
  var control = useFormContext().control;
42
42
  var t = useTranslation().t;
43
+ var dispatch = useAppDispatch();
43
44
  var influencerControl = useController({ name: 'isInfluencer', control: control });
44
- var data = useAppSelector(individualSelector).data;
45
- var user = (data.verify.responseBody || {}).user;
45
+ var error = useAppSelector(individualSelector).error;
46
46
  var disabled = false;
47
47
  var handleOnChange = function (_a) {
48
48
  var target = _a.target;
49
+ if (error)
50
+ dispatch(clearError());
49
51
  influencerControl.field.onChange(target.value === 'yes');
50
52
  };
51
53
  var influencerValue = influencerControl.field.value;
52
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: [_jsxs(LabelTextStyled, { children: [t('tap_js_are_you_an_influencer'), _jsx(Mandatory, {})] }), _jsx(Tooltip, __assign({ title: t('influencer_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] })), _jsxs(RadioGroupStyled, __assign({ value: influencerValue != null ? (influencerValue ? 'yes' : 'no') : false, onChange: disabled ? undefined : handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: t('yes') }), _jsx(RadioLabel, { value: 'no', label: t('no') })] }))] })) })));
54
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: [_jsxs(LabelTextStyled, { children: [t('tap_js_are_you_an_influencer'), _jsx(Mandatory, {})] }), _jsx(Tooltip, __assign({ title: t('influencer_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] })), _jsxs(RadioGroupStyled, __assign({ readOnly: readOnly, value: influencerValue != null ? (influencerValue ? 'yes' : 'no') : false, onChange: disabled || readOnly ? undefined : handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: t('yes') }), _jsx(RadioLabel, { value: 'no', label: t('no') })] }))] })) })));
53
55
  };
54
56
  export default React.memo(InfluencerSwitch);
@@ -5,6 +5,7 @@ interface MonthlyIncomeProps {
5
5
  onSelectSource?: (country: MonthlyIncomeType) => void;
6
6
  onListOpen?: () => void;
7
7
  onListClose?: () => void;
8
+ readOnly?: boolean;
8
9
  }
9
- declare const _default: React.MemoExoticComponent<({ ...rest }: MonthlyIncomeProps) => JSX.Element>;
10
+ declare const _default: React.MemoExoticComponent<(props: MonthlyIncomeProps) => JSX.Element>;
10
11
  export default _default;
@@ -9,17 +9,6 @@ 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
- };
23
12
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { useTranslation } from 'react-i18next';
@@ -30,8 +19,8 @@ import { ScreenContainer } from '../../../shared/Containers';
30
19
  import Input from '../../../shared/Input';
31
20
  import CheckIcon from '../../../shared/CheckIcon';
32
21
  import Collapse from '../../../../components/Collapse';
33
- import { useAppSelector, useLanguage } from '../../../../hooks';
34
- import { individualSelector } from '../../../app/individual/individualStore';
22
+ import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
23
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
35
24
  import Text from '../../../../components/Text';
36
25
  import ExpandIcon from '../../../../components/ExpandIcon';
37
26
  import SimpleList from '../../../../components/SimpleList';
@@ -40,6 +29,14 @@ import { settingsSelector } from '../../../../app/settings';
40
29
  var Container = styled(Box)(function () { return ({
41
30
  display: 'flex'
42
31
  }); });
32
+ var InputStyled = styled(Input)(function (_a) {
33
+ var readOnly = _a.readOnly;
34
+ return ({
35
+ '& .MuiInputBase-input': {
36
+ cursor: readOnly ? 'default' : 'pointer'
37
+ }
38
+ });
39
+ });
43
40
  var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
44
41
  var theme = _a.theme, isSelected = _a.isSelected;
45
42
  return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
@@ -52,20 +49,19 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
52
49
  alignItems: 'flex-end'
53
50
  });
54
51
  });
55
- var MonthlyIncome = function (_a) {
56
- var _b;
57
- var rest = __rest(_a, []);
58
- var _c = React.useState([]), incomeList = _c[0], setIncomeList = _c[1];
59
- var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
52
+ var MonthlyIncome = function (props) {
53
+ var _a;
54
+ var _b = React.useState([]), incomeList = _b[0], setIncomeList = _b[1];
55
+ var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
60
56
  var t = useTranslation().t;
61
57
  var isAr = useLanguage().isAr;
62
- var data = useAppSelector(individualSelector).data;
58
+ var dispatch = useAppDispatch();
59
+ var _d = useAppSelector(individualSelector), data = _d.data, bckError = _d.error;
63
60
  var control = useFormContext().control;
64
61
  var settingsData = useAppSelector(settingsSelector).data;
65
62
  var monthlyIncomeList = (data.individualData.responseBody || {}).monthlyIncomeList;
66
63
  var monthlyIncomeControl = useController({ control: control, name: 'monthlyIncome' });
67
64
  var countryCode = settingsData.businessCountry;
68
- var user = (data.verify.responseBody || {}).user;
69
65
  var disabled = false;
70
66
  React.useEffect(function () {
71
67
  if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
@@ -74,26 +70,30 @@ var MonthlyIncome = function (_a) {
74
70
  }, [monthlyIncomeList]);
75
71
  var onOpenList = function (event) {
76
72
  var _a;
73
+ if (props.readOnly)
74
+ return;
77
75
  setAnchorEl(event.currentTarget);
78
- (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
76
+ (_a = props.onListOpen) === null || _a === void 0 ? void 0 : _a.call(props);
79
77
  };
80
78
  var onCloseList = function () {
81
79
  var _a;
82
80
  setAnchorEl(null);
83
- (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
81
+ (_a = props.onListClose) === null || _a === void 0 ? void 0 : _a.call(props);
84
82
  if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
85
83
  setIncomeList(monthlyIncomeList);
86
84
  }
87
85
  };
88
86
  var onSelectItem = function (source) {
87
+ if (bckError)
88
+ dispatch(clearError());
89
89
  onCloseList();
90
90
  monthlyIncomeControl.field.onChange(source);
91
91
  };
92
92
  var income = monthlyIncomeControl.field.value;
93
- var error = (_b = monthlyIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
94
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(Input, { label: t('please_enter_actual_income', {
93
+ var error = (_a = monthlyIncomeControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
94
+ return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(InputStyled, { label: t('please_enter_actual_income', {
95
95
  currency: t(findCurrencyByIso2(countryCode.iso2))
96
- }), disabled: disabled, readOnly: true, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'range.en', searchValuePath: ['range.en', 'range.ar'], list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
96
+ }), disabled: disabled, readOnly: props.readOnly, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'range.en', searchValuePath: ['range.en', 'range.ar'], list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
97
97
  return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIconStyled, {})] }));
98
98
  } }) }))] })) })));
99
99
  };
@@ -5,6 +5,7 @@ interface OccupationProps {
5
5
  onSelectOccupation?: (occupation: OccupationType) => void;
6
6
  onListOpen?: () => void;
7
7
  onListClose?: () => void;
8
+ readOnly?: boolean;
8
9
  }
9
- declare const Occupation: ({ ...rest }: OccupationProps) => JSX.Element;
10
+ declare const Occupation: (props: OccupationProps) => JSX.Element;
10
11
  export default Occupation;