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

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