@tap-payments/auth-jsconnect 1.0.4 → 1.0.7

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 (335) hide show
  1. package/build/@types/app.d.ts +74 -0
  2. package/build/@types/app.js +11 -1
  3. package/build/@types/theme.d.ts +12 -3
  4. package/build/@types/theme.js +15 -1
  5. package/build/app/rootReducer.d.ts +1 -1
  6. package/build/app/rootReducer.js +1 -1
  7. package/build/app/settings.d.ts +7 -2
  8. package/build/app/settings.js +36 -6
  9. package/build/app/store.d.ts +2 -2
  10. package/build/assets/locales/ar.json +70 -3
  11. package/build/assets/locales/en.json +69 -2
  12. package/build/components/AnimationFlow/BottomSheet.d.ts +3 -2
  13. package/build/components/AnimationFlow/BottomSheet.js +30 -3
  14. package/build/components/AnimationFlow/Dialog.d.ts +3 -2
  15. package/build/components/AnimationFlow/Dialog.js +26 -18
  16. package/build/components/Button/Button.d.ts +7 -3
  17. package/build/components/Button/Button.js +20 -2
  18. package/build/components/Collapse/Collapse.d.ts +5 -0
  19. package/build/components/Collapse/Collapse.js +28 -0
  20. package/build/components/Collapse/index.d.ts +3 -0
  21. package/build/components/Collapse/index.js +2 -0
  22. package/build/components/DatePicker/DatePicker.js +3 -3
  23. package/build/components/Footer/Footer.js +1 -1
  24. package/build/components/Input/Input.d.ts +4 -1
  25. package/build/components/Input/Input.js +7 -5
  26. package/build/components/Loader/Loader.d.ts +10 -8
  27. package/build/components/Loader/Loader.js +21 -41
  28. package/build/components/OTPField/OTPField.js +3 -23
  29. package/build/components/OTPTimer/OTPTimer.d.ts +4 -2
  30. package/build/components/OTPTimer/OTPTimer.js +20 -8
  31. package/build/components/Providers/ThemeProvider.js +6 -9
  32. package/build/components/SimpleList/SimpleList.d.ts +11 -3
  33. package/build/components/SimpleList/SimpleList.js +51 -22
  34. package/build/components/Slide/Slide.d.ts +6 -0
  35. package/build/components/Slide/Slide.js +30 -0
  36. package/build/components/Slide/index.d.ts +3 -0
  37. package/build/components/Slide/index.js +2 -0
  38. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +14 -0
  39. package/build/components/SocialMediaGroup/SocialMediaGroup.js +86 -0
  40. package/build/components/SocialMediaGroup/index.d.ts +3 -0
  41. package/build/components/SocialMediaGroup/index.js +2 -0
  42. package/build/components/ToggleButton/ToggleButton.d.ts +5 -0
  43. package/build/components/ToggleButton/ToggleButton.js +44 -0
  44. package/build/components/ToggleButton/index.d.ts +3 -0
  45. package/build/components/ToggleButton/index.js +2 -0
  46. package/build/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +5 -0
  47. package/build/components/ToggleButtonGroup/ToggleButtonGroup.js +37 -0
  48. package/build/components/ToggleButtonGroup/index.d.ts +3 -0
  49. package/build/components/ToggleButtonGroup/index.js +2 -0
  50. package/build/components/Tooltip/Tooltip.d.ts +10 -0
  51. package/build/components/Tooltip/Tooltip.js +44 -0
  52. package/build/components/Tooltip/index.d.ts +3 -0
  53. package/build/components/Tooltip/index.js +2 -0
  54. package/build/components/Warning/Warning.d.ts +2 -1
  55. package/build/components/Warning/Warning.js +4 -19
  56. package/build/constants/app.d.ts +14 -4
  57. package/build/constants/app.js +145 -4
  58. package/build/constants/assets.d.ts +11 -0
  59. package/build/constants/assets.js +12 -1
  60. package/build/constants/dummy.d.ts +103 -0
  61. package/build/constants/dummy.js +219 -0
  62. package/build/constants/index.d.ts +1 -0
  63. package/build/constants/index.js +1 -0
  64. package/build/constants/validation.d.ts +6 -0
  65. package/build/constants/validation.js +6 -0
  66. package/build/features/app/{midStore.d.ts → business/midStore.d.ts} +2 -2
  67. package/build/features/app/{midStore.js → business/midStore.js} +0 -0
  68. package/build/features/app/connect/midStore.d.ts +10 -0
  69. package/build/features/app/connect/midStore.js +18 -0
  70. package/build/features/bank/Bank.d.ts +6 -0
  71. package/build/features/bank/Bank.js +48 -0
  72. package/build/features/bank/index.d.ts +1 -0
  73. package/build/features/bank/index.js +1 -0
  74. package/build/features/bank/screens/BankDetails/BankDetails.d.ts +5 -0
  75. package/build/features/bank/screens/BankDetails/BankDetails.js +57 -0
  76. package/build/features/bank/screens/BankDetails/BankName.d.ts +3 -0
  77. package/build/features/bank/screens/BankDetails/BankName.js +27 -0
  78. package/build/features/bank/screens/BankDetails/Beneficiary.d.ts +5 -0
  79. package/build/features/bank/screens/BankDetails/Beneficiary.js +34 -0
  80. package/build/features/bank/screens/BankDetails/IBAN.d.ts +5 -0
  81. package/build/features/bank/screens/BankDetails/IBAN.js +35 -0
  82. package/build/features/bank/screens/BankDetails/index.d.ts +3 -0
  83. package/build/features/bank/screens/BankDetails/index.js +2 -0
  84. package/build/features/bank/screens/BankDetails/validation.d.ts +14 -0
  85. package/build/features/bank/screens/BankDetails/validation.js +9 -0
  86. package/build/features/business/Business.d.ts +6 -0
  87. package/build/features/business/Business.js +61 -0
  88. package/build/features/business/index.d.ts +1 -0
  89. package/build/features/business/index.js +1 -0
  90. package/build/features/business/screens/Activities/Activities.d.ts +5 -0
  91. package/build/features/business/screens/Activities/Activities.js +83 -0
  92. package/build/features/business/screens/Activities/ActivitiesList.d.ts +70 -0
  93. package/build/features/business/screens/Activities/ActivitiesList.js +136 -0
  94. package/build/features/business/screens/Activities/SalesChannels.d.ts +5 -0
  95. package/build/features/business/screens/Activities/SalesChannels.js +107 -0
  96. package/build/features/business/screens/Activities/index.d.ts +3 -0
  97. package/build/features/business/screens/Activities/index.js +2 -0
  98. package/build/features/business/screens/Activities/validation.d.ts +119 -0
  99. package/build/features/business/screens/Activities/validation.js +17 -0
  100. package/build/features/business/screens/BusinessType/BusinessType.d.ts +12 -0
  101. package/build/features/business/screens/BusinessType/BusinessType.js +85 -0
  102. package/build/features/business/screens/BusinessType/CRNumber.d.ts +6 -0
  103. package/build/features/business/screens/BusinessType/CRNumber.js +40 -0
  104. package/build/features/business/screens/BusinessType/CompanyLicense.d.ts +11 -0
  105. package/build/features/business/screens/BusinessType/CompanyLicense.js +109 -0
  106. package/build/features/business/screens/BusinessType/FLNumber.d.ts +6 -0
  107. package/build/features/business/screens/BusinessType/FLNumber.js +40 -0
  108. package/build/features/business/screens/BusinessType/FreelanceLicense.d.ts +11 -0
  109. package/build/features/business/screens/BusinessType/FreelanceLicense.js +112 -0
  110. package/build/features/business/screens/BusinessType/SelectType.d.ts +8 -0
  111. package/build/features/business/screens/BusinessType/SelectType.js +106 -0
  112. package/build/features/business/screens/BusinessType/Switch.d.ts +7 -0
  113. package/build/features/business/screens/BusinessType/Switch.js +35 -0
  114. package/build/features/business/screens/BusinessType/index.d.ts +3 -0
  115. package/build/features/business/screens/BusinessType/index.js +2 -0
  116. package/build/features/business/screens/BusinessType/validation.d.ts +15 -0
  117. package/build/features/business/screens/BusinessType/validation.js +14 -0
  118. package/build/features/business/screens/Confirm/Confirm.d.ts +5 -0
  119. package/build/features/business/screens/Confirm/Confirm.js +53 -0
  120. package/build/features/business/screens/Confirm/index.d.ts +3 -0
  121. package/build/features/business/screens/Confirm/index.js +2 -0
  122. package/build/features/business/screens/Customers/CustomerLocations.d.ts +92 -0
  123. package/build/features/business/screens/Customers/CustomerLocations.js +122 -0
  124. package/build/features/business/screens/Customers/Customers.d.ts +5 -0
  125. package/build/features/business/screens/Customers/Customers.js +92 -0
  126. package/build/features/business/screens/Customers/ExpectedCustomers.d.ts +7 -0
  127. package/build/features/business/screens/Customers/ExpectedCustomers.js +78 -0
  128. package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +7 -0
  129. package/build/features/business/screens/Customers/ExpectedSalesRange.js +74 -0
  130. package/build/features/business/screens/Customers/RefundPolicy.d.ts +44 -0
  131. package/build/features/business/screens/Customers/RefundPolicy.js +86 -0
  132. package/build/features/business/screens/Customers/TransactionPolicy.d.ts +3 -0
  133. package/build/features/business/screens/Customers/TransactionPolicy.js +37 -0
  134. package/build/features/business/screens/Customers/index.d.ts +3 -0
  135. package/build/features/business/screens/Customers/index.js +2 -0
  136. package/build/features/business/screens/Customers/validation.d.ts +20 -0
  137. package/build/features/business/screens/Customers/validation.js +8 -0
  138. package/build/features/business/screens/IDBOD/DOB.d.ts +5 -0
  139. package/build/features/business/screens/IDBOD/DOB.js +44 -0
  140. package/build/features/business/screens/IDBOD/ID.d.ts +5 -0
  141. package/build/features/business/screens/IDBOD/ID.js +69 -0
  142. package/build/features/business/screens/IDBOD/IDBOD.d.ts +5 -0
  143. package/build/features/business/screens/IDBOD/IDBOD.js +85 -0
  144. package/build/features/business/screens/IDBOD/index.d.ts +3 -0
  145. package/build/features/business/screens/IDBOD/index.js +2 -0
  146. package/build/features/business/screens/IDBOD/validation.d.ts +11 -0
  147. package/build/features/business/screens/IDBOD/validation.js +5 -0
  148. package/build/features/business/screens/OTP/OTP.d.ts +11 -0
  149. package/build/features/business/screens/OTP/OTP.js +112 -0
  150. package/build/features/business/screens/OTP/OTPInput.d.ts +5 -0
  151. package/build/features/business/screens/OTP/OTPInput.js +51 -0
  152. package/build/features/business/screens/OTP/OTPTimer.d.ts +5 -0
  153. package/build/features/business/screens/OTP/OTPTimer.js +20 -0
  154. package/build/features/business/screens/OTP/index.d.ts +3 -0
  155. package/build/features/business/screens/OTP/index.js +2 -0
  156. package/build/features/business/screens/OTP/validation.d.ts +8 -0
  157. package/build/features/business/screens/OTP/validation.js +4 -0
  158. package/build/features/business/screens/Success/Success.d.ts +5 -0
  159. package/build/features/business/screens/Success/Success.js +15 -0
  160. package/build/features/business/screens/Success/index.d.ts +3 -0
  161. package/build/features/business/screens/Success/index.js +2 -0
  162. package/build/features/business/screens/VerifyNumber/OTPInput.d.ts +6 -0
  163. package/build/features/business/screens/VerifyNumber/OTPInput.js +68 -0
  164. package/build/features/business/screens/VerifyNumber/OTPTimer.d.ts +5 -0
  165. package/build/features/business/screens/VerifyNumber/OTPTimer.js +20 -0
  166. package/build/features/business/screens/VerifyNumber/VerifyNumber.d.ts +13 -0
  167. package/build/features/business/screens/VerifyNumber/VerifyNumber.js +119 -0
  168. package/build/features/business/screens/VerifyNumber/index.d.ts +3 -0
  169. package/build/features/business/screens/VerifyNumber/index.js +2 -0
  170. package/build/features/business/screens/VerifyNumber/validation.d.ts +8 -0
  171. package/build/features/business/screens/VerifyNumber/validation.js +4 -0
  172. package/build/features/connect/Connect.js +20 -22
  173. package/build/features/connect/screens/Individual/Email.d.ts +5 -0
  174. package/build/features/connect/screens/Individual/Email.js +31 -0
  175. package/build/features/connect/screens/Individual/Individual.d.ts +5 -0
  176. package/build/features/connect/screens/Individual/Individual.js +77 -0
  177. package/build/features/connect/screens/Individual/Name.d.ts +5 -0
  178. package/build/features/connect/screens/Individual/Name.js +31 -0
  179. package/build/features/connect/screens/Individual/index.d.ts +3 -0
  180. package/build/features/connect/screens/Individual/index.js +2 -0
  181. package/build/features/connect/screens/Individual/validation.d.ts +11 -0
  182. package/build/features/connect/screens/Individual/validation.js +5 -0
  183. package/build/features/connect/screens/MID/BusinessCountry.d.ts +2 -6
  184. package/build/features/connect/screens/MID/BusinessCountry.js +20 -79
  185. package/build/features/connect/screens/MID/IDNumber.d.ts +0 -4
  186. package/build/features/connect/screens/MID/IDNumber.js +24 -36
  187. package/build/features/connect/screens/MID/MID.js +41 -24
  188. package/build/features/connect/screens/MID/MIDTitle.js +2 -2
  189. package/build/features/connect/screens/MID/MobileNumber.d.ts +2 -7
  190. package/build/features/connect/screens/MID/MobileNumber.js +40 -84
  191. package/build/features/connect/screens/MID/validation.d.ts +18 -0
  192. package/build/features/connect/screens/MID/validation.js +8 -0
  193. package/build/features/connect/screens/Merchant/BrandName.d.ts +5 -0
  194. package/build/features/connect/screens/Merchant/BrandName.js +73 -0
  195. package/build/features/connect/screens/Merchant/Merchant.d.ts +5 -0
  196. package/build/features/connect/screens/Merchant/Merchant.js +50 -0
  197. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +5 -0
  198. package/build/features/connect/screens/Merchant/SocialMedia.js +79 -0
  199. package/build/features/connect/screens/Merchant/TAC.d.ts +5 -0
  200. package/build/features/connect/screens/Merchant/TAC.js +79 -0
  201. package/build/features/connect/screens/Merchant/index.d.ts +3 -0
  202. package/build/features/connect/screens/Merchant/index.js +2 -0
  203. package/build/features/connect/screens/Merchant/validation.d.ts +50 -0
  204. package/build/features/connect/screens/Merchant/validation.js +23 -0
  205. package/build/features/connect/screens/OTP/OTP.d.ts +6 -2
  206. package/build/features/connect/screens/OTP/OTP.js +41 -46
  207. package/build/features/connect/screens/OTP/OTPInput.d.ts +5 -0
  208. package/build/features/connect/screens/OTP/OTPInput.js +38 -0
  209. package/build/features/connect/screens/OTP/validation.d.ts +8 -0
  210. package/build/features/connect/screens/OTP/validation.js +4 -0
  211. package/build/features/connect/screens/Password/Password.d.ts +5 -0
  212. package/build/features/connect/screens/Password/Password.js +49 -0
  213. package/build/features/connect/screens/Password/PasswordInput.d.ts +5 -0
  214. package/build/features/connect/screens/Password/PasswordInput.js +38 -0
  215. package/build/features/connect/screens/Password/index.d.ts +3 -0
  216. package/build/features/connect/screens/Password/index.js +2 -0
  217. package/build/features/connect/screens/Password/validation.d.ts +8 -0
  218. package/build/features/connect/screens/Password/validation.js +4 -0
  219. package/build/features/connect/screens/ThankYou/ThankYou.d.ts +5 -0
  220. package/build/features/connect/screens/ThankYou/ThankYou.js +15 -0
  221. package/build/features/connect/screens/ThankYou/index.d.ts +3 -0
  222. package/build/features/connect/screens/ThankYou/index.js +2 -0
  223. package/build/features/featuresScreens.d.ts +7 -0
  224. package/build/features/featuresScreens.js +99 -0
  225. package/build/features/owner/Owner.d.ts +6 -0
  226. package/build/features/owner/Owner.js +50 -0
  227. package/build/features/owner/index.d.ts +1 -0
  228. package/build/features/owner/index.js +1 -0
  229. package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.d.ts +19 -0
  230. package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.js +52 -0
  231. package/build/features/owner/screens/ShowOwnerInfo/index.d.ts +3 -0
  232. package/build/features/owner/screens/ShowOwnerInfo/index.js +2 -0
  233. package/build/features/owner/screens/ShowOwnerInfo/info.d.ts +7 -0
  234. package/build/features/owner/screens/ShowOwnerInfo/info.js +28 -0
  235. package/build/features/password/Password.d.ts +6 -0
  236. package/build/features/password/Password.js +50 -0
  237. package/build/features/password/index.d.ts +1 -0
  238. package/build/features/password/index.js +1 -0
  239. package/build/features/password/screens/CreatePassword/ConditionText.d.ts +7 -0
  240. package/build/features/password/screens/CreatePassword/ConditionText.js +23 -0
  241. package/build/features/password/screens/CreatePassword/ConfirmPassword.d.ts +5 -0
  242. package/build/features/password/screens/CreatePassword/ConfirmPassword.js +27 -0
  243. package/build/features/password/screens/CreatePassword/CreatePassword.d.ts +5 -0
  244. package/build/features/password/screens/CreatePassword/CreatePassword.js +51 -0
  245. package/build/features/password/screens/CreatePassword/Password.d.ts +5 -0
  246. package/build/features/password/screens/CreatePassword/Password.js +75 -0
  247. package/build/features/password/screens/CreatePassword/PasswordBar.d.ts +7 -0
  248. package/build/features/password/screens/CreatePassword/PasswordBar.js +29 -0
  249. package/build/features/password/screens/CreatePassword/index.d.ts +3 -0
  250. package/build/features/password/screens/CreatePassword/index.js +2 -0
  251. package/build/features/password/screens/CreatePassword/validation.d.ts +11 -0
  252. package/build/features/password/screens/CreatePassword/validation.js +8 -0
  253. package/build/features/shared/Button/Button.d.ts +8 -0
  254. package/build/features/shared/Button/Button.js +49 -0
  255. package/build/features/shared/Button/index.d.ts +2 -0
  256. package/build/features/shared/Button/index.js +2 -0
  257. package/build/features/shared/CheckIcon/CheckIcon.d.ts +2 -0
  258. package/build/features/shared/CheckIcon/CheckIcon.js +14 -0
  259. package/build/features/shared/CheckIcon/index.d.ts +2 -0
  260. package/build/features/shared/CheckIcon/index.js +2 -0
  261. package/build/features/shared/ClearIcon/ClearIcon.d.ts +6 -0
  262. package/build/features/shared/ClearIcon/ClearIcon.js +26 -0
  263. package/build/features/shared/ClearIcon/index.d.ts +2 -0
  264. package/build/features/shared/ClearIcon/index.js +2 -0
  265. package/build/features/shared/Containers/FeatureContainer.d.ts +4 -0
  266. package/build/features/shared/Containers/FeatureContainer.js +33 -0
  267. package/build/features/shared/Containers/ScreenContainer.d.ts +4 -0
  268. package/build/features/shared/Containers/ScreenContainer.js +28 -0
  269. package/build/features/shared/Containers/index.d.ts +3 -0
  270. package/build/features/shared/Containers/index.js +3 -0
  271. package/build/features/shared/ExpandIcon/ExpandIcon.d.ts +7 -0
  272. package/build/features/shared/ExpandIcon/ExpandIcon.js +24 -0
  273. package/build/features/shared/ExpandIcon/index.d.ts +2 -0
  274. package/build/features/shared/ExpandIcon/index.js +2 -0
  275. package/build/features/shared/Footer/Footer.d.ts +2 -0
  276. package/build/features/shared/Footer/Footer.js +16 -0
  277. package/build/features/shared/Footer/index.d.ts +2 -0
  278. package/build/features/shared/Footer/index.js +2 -0
  279. package/build/features/shared/Input/Input.d.ts +27 -0
  280. package/build/features/shared/Input/Input.js +59 -0
  281. package/build/features/shared/Input/index.d.ts +2 -0
  282. package/build/features/shared/Input/index.js +2 -0
  283. package/build/features/shared/OTP/OTP.d.ts +9 -0
  284. package/build/features/shared/OTP/OTP.js +85 -0
  285. package/build/features/shared/OTP/index.d.ts +2 -0
  286. package/build/features/shared/OTP/index.js +2 -0
  287. package/build/features/shared/PasswordIcon/PasswordIcon.d.ts +8 -0
  288. package/build/features/shared/PasswordIcon/PasswordIcon.js +37 -0
  289. package/build/features/shared/PasswordIcon/index.d.ts +2 -0
  290. package/build/features/shared/PasswordIcon/index.js +2 -0
  291. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +7 -0
  292. package/build/features/shared/SuccessScreen/SuccessScreen.js +54 -0
  293. package/build/features/shared/SuccessScreen/index.d.ts +2 -0
  294. package/build/features/shared/SuccessScreen/index.js +2 -0
  295. package/build/features/tax/Tax.d.ts +6 -0
  296. package/build/features/tax/Tax.js +50 -0
  297. package/build/features/tax/index.d.ts +1 -0
  298. package/build/features/tax/index.js +1 -0
  299. package/build/features/tax/screens/TaxDetails/TaxDetails.d.ts +5 -0
  300. package/build/features/tax/screens/TaxDetails/TaxDetails.js +45 -0
  301. package/build/features/tax/screens/TaxDetails/VATId.d.ts +3 -0
  302. package/build/features/tax/screens/TaxDetails/VATId.js +27 -0
  303. package/build/features/tax/screens/TaxDetails/index.d.ts +3 -0
  304. package/build/features/tax/screens/TaxDetails/index.js +2 -0
  305. package/build/features/tax/screens/TaxDetails/validation.d.ts +8 -0
  306. package/build/features/tax/screens/TaxDetails/validation.js +4 -0
  307. package/build/hooks/index.d.ts +5 -0
  308. package/build/hooks/index.js +5 -0
  309. package/build/hooks/useAppDispatch.d.ts +4 -0
  310. package/build/hooks/useAppDispatch.js +2 -0
  311. package/build/hooks/useAppSelector.d.ts +3 -0
  312. package/build/hooks/useAppSelector.js +2 -0
  313. package/build/hooks/useAppTheme.js +3 -2
  314. package/build/hooks/useContainerDimensions.d.ts +4 -0
  315. package/build/hooks/useContainerDimensions.js +21 -0
  316. package/build/hooks/useEventListener.d.ts +5 -0
  317. package/build/hooks/useEventListener.js +20 -0
  318. package/build/hooks/useLanguage.d.ts +4 -0
  319. package/build/hooks/useLanguage.js +8 -0
  320. package/build/index.css +6 -1
  321. package/build/index.d.ts +7 -2
  322. package/build/index.js +17 -2
  323. package/build/theme/palette.js +11 -4
  324. package/build/theme/theme.d.ts +1 -1
  325. package/build/theme/theme.js +0 -1
  326. package/build/theme/typography.js +2 -2
  327. package/build/utils/array.d.ts +3 -1
  328. package/build/utils/array.js +7 -3
  329. package/build/utils/string.d.ts +3 -1
  330. package/build/utils/string.js +11 -2
  331. package/build/utils/validation.d.ts +10 -0
  332. package/build/utils/validation.js +30 -0
  333. package/package.json +120 -116
  334. package/build/app/hooks.d.ts +0 -7
  335. package/build/app/hooks.js +0 -3
@@ -13,49 +13,29 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import Box from '@mui/material/Box';
15
15
  import { useTranslation } from 'react-i18next';
16
+ import { useController, useFormContext } from 'react-hook-form';
16
17
  import { styled, alpha } from '@mui/material/styles';
17
18
  import Text from '../../../../components/Text';
18
19
  import Tooltip from '@mui/material/Tooltip';
19
20
  import Icon from '../../../../components/Icon';
20
- import Input from '../../../../components/Input';
21
- import ClearIcon from '@mui/icons-material/Clear';
22
- import Collapse from '@mui/material/Collapse';
21
+ import Input from '../../../../features/shared/Input';
22
+ import ClearIcon from '../../../../features/shared/ClearIcon';
23
+ import Collapse from '../../../../components/Collapse';
23
24
  import DatePicker from '../../../../components/DatePicker';
25
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
26
  import { removeAllCharsFromNumber } from '../../../../utils';
25
27
  import { ICONS_NAMES, ID_NUMBER_LENGTH } from '../../../../constants';
26
- var BoxStyled = styled(Box)(function () { return ({
27
- display: 'flex',
28
- flexDirection: 'column'
29
- }); });
30
28
  var LabelContainerStyled = styled(Box)(function (_a) {
31
29
  var theme = _a.theme;
32
30
  return ({
33
31
  display: 'flex',
34
32
  justifyContent: 'space-between',
35
- padding: theme.spacing(0, 2.5, 1, 2.5)
33
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
36
34
  });
37
35
  });
38
36
  var InputLabelStyled = styled(Text)(function (_a) {
39
37
  var theme = _a.theme;
40
- return ({
41
- color: alpha(theme.palette.text.primary, 0.4),
42
- fontSize: theme.spacing(1.5)
43
- });
44
- });
45
- var InputStyled = styled(Input)(function (_a) {
46
- var theme = _a.theme;
47
- return ({
48
- padding: theme.spacing(0, 2, 0, 0)
49
- });
50
- });
51
- var ClearIconStyled = styled(ClearIcon)(function (_a) {
52
- var theme = _a.theme;
53
- return ({
54
- width: theme.spacing(2),
55
- height: theme.spacing(2),
56
- cursor: 'pointer',
57
- color: alpha(theme.palette.text.primary, 0.4)
58
- });
38
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
59
39
  });
60
40
  var IconStyled = styled(Icon)(function (_a) {
61
41
  var theme = _a.theme;
@@ -66,23 +46,31 @@ var IconStyled = styled(Icon)(function (_a) {
66
46
  });
67
47
  });
68
48
  var IDNumber = React.forwardRef(function (_a, ref) {
69
- var onBirthDateChange = _a.onBirthDateChange, onIdChange = _a.onIdChange, onSwitchToMobileNumber = _a.onSwitchToMobileNumber, show = _a.show;
70
- var _b = React.useState(''), idValue = _b[0], seIdValue = _b[1];
49
+ var _b;
50
+ var onSwitchToMobileNumber = _a.onSwitchToMobileNumber, show = _a.show;
71
51
  var t = useTranslation().t;
52
+ var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
53
+ var nidControl = useController({ control: control, name: 'nid' });
54
+ var dobControl = useController({ control: control, name: 'dob' });
55
+ React.useEffect(function () {
56
+ if (nidControl.field.value)
57
+ setValue('nid', nidControl.field.value, { shouldValidate: true });
58
+ if (dobControl.field.value)
59
+ setValue('dob', dobControl.field.value, { shouldValidate: true });
60
+ }, [show]);
72
61
  var handleIdChange = function (_a) {
73
62
  var target = _a.target;
74
- target.value = removeAllCharsFromNumber(target.value);
75
- seIdValue(target.value);
76
- onIdChange === null || onIdChange === void 0 ? void 0 : onIdChange(target.value);
63
+ var value = removeAllCharsFromNumber(target.value);
64
+ nidControl.field.onChange(value);
77
65
  };
78
66
  var clearIdNumber = function () {
79
- seIdValue('');
80
- onIdChange === null || onIdChange === void 0 ? void 0 : onIdChange('');
67
+ nidControl.field.onChange('');
81
68
  };
82
69
  var handleBirthDateChange = function (data) {
83
- onBirthDateChange === null || onBirthDateChange === void 0 ? void 0 : onBirthDateChange(data);
70
+ dobControl.field.onChange(data);
84
71
  };
85
- return (_jsx(Collapse, __assign({ in: show, unmountOnExit: true, timeout: 500 }, { children: _jsxs(BoxStyled, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('id_number_label') }), _jsx(Tooltip, __assign({ title: t('switch_to_mobile') }, { children: _jsx(IconStyled, { onClick: onSwitchToMobileNumber, alt: 'switcher icon', src: ICONS_NAMES.MOBILE_IMAGE }) }))] }), _jsx(InputStyled, { dir: 'ltr', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: idValue && _jsx(ClearIconStyled, { onClick: clearIdNumber }), placeholder: '0000000000' }), _jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
72
+ var nidValue = nidControl.field.value;
73
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('id_number_label') }), _jsx(Tooltip, __assign({ title: t('switch_to_mobile') }, { children: _jsx(IconStyled, { onClick: onSwitchToMobileNumber, alt: 'switcher icon', src: ICONS_NAMES.MOBILE_IMAGE }) }))] }), _jsx(Input, { dir: 'ltr', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message }), _jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
86
74
  var spacing = _a.spacing;
87
75
  return spacing(2.5, 2.5, 1.5, 2.5);
88
76
  } } }, { children: t('date_of_birth') })), _jsx(DatePicker, { defaultValue: new Date('2000-01-01'), readOnly: true, dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange })] })) })));
@@ -12,22 +12,37 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import Box from '@mui/material/Box';
15
- import { useForm } from 'react-hook-form';
15
+ import { useForm, FormProvider } from 'react-hook-form';
16
+ import { yupResolver } from '@hookform/resolvers/yup';
16
17
  import { useTranslation } from 'react-i18next';
17
18
  import { styled } from '@mui/material/styles';
18
- import Slide from '@mui/material/Slide';
19
+ import Collapse from '../../../../components/Collapse';
19
20
  import Form from '../../../../components/Form';
21
+ import Button from '../../../../features/shared/Button';
22
+ import { useAppDispatch } from '../../../../hooks';
23
+ import { handleNextScreenStep } from '../../../../app/settings';
24
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
25
+ import { useLanguage } from '../../../../hooks';
20
26
  import MIDTitle from './MIDTitle';
21
27
  import MobileNumber from './MobileNumber';
22
28
  import IDNumber from './IDNumber';
23
29
  import BusinessCountry from './BusinessCountry';
30
+ import { NIDValidationSchema, PhoneValidationSchema } from './validation';
24
31
  import { countriesCode, defaultCountry, businessCountries } from '../../../../constants/dummy';
25
- var BoxStyled = styled(Box)(function (_a) {
26
- var theme = _a.theme;
27
- return ({
28
- padding: theme.spacing(2.5, 0, 2.5, 0),
29
- overflow: 'hidden'
30
- });
32
+ var FormStyled = styled(Form)(function () { return ({
33
+ display: 'flex',
34
+ flexDirection: 'column'
35
+ }); });
36
+ var InputsContainerStyled = styled(Box)(function (_a) {
37
+ var _b;
38
+ var theme = _a.theme, listActive = _a.listActive;
39
+ return (_b = {
40
+ paddingBottom: theme.spacing(listActive ? 0 : 5)
41
+ },
42
+ _b[theme.transitions.create(['padding-bottom'])] = {
43
+ duration: theme.transitions.duration.standard
44
+ },
45
+ _b);
31
46
  });
32
47
  var ListType;
33
48
  (function (ListType) {
@@ -37,28 +52,30 @@ var ListType;
37
52
  var MID = function (_a) {
38
53
  var _b = React.useState(false), isNID = _b[0], setIsNID = _b[1];
39
54
  var _c = React.useState(), listType = _c[0], setListType = _c[1];
40
- var control = useForm().control;
55
+ var dispatch = useAppDispatch();
56
+ var methods = useForm({
57
+ resolver: yupResolver(isNID ? NIDValidationSchema : PhoneValidationSchema),
58
+ defaultValues: {
59
+ countryCode: defaultCountry,
60
+ businessCountry: defaultCountry,
61
+ nid: '',
62
+ dob: '',
63
+ mobile: ''
64
+ },
65
+ mode: 'onChange'
66
+ });
41
67
  var t = useTranslation().t;
68
+ var isAr = useLanguage().isAr;
42
69
  var handleMenuListClick = function (flag) {
43
70
  setListType(flag);
44
71
  };
45
- var onNIDChange = function (id) {
46
- console.log(id);
47
- };
48
- var onMobileChange = function (mobile) {
49
- console.log(mobile);
50
- };
51
- var onBirthDateChange = function (data) {
52
- console.log(data);
53
- };
54
- var onSelectCountryCode = function (country) {
55
- console.log(country);
56
- };
57
- var onSelectBusinessCountry = function (country) {
58
- console.log(country);
72
+ var onSubmit = function (data) {
73
+ console.log('data', data);
74
+ dispatch(handleNextScreenStep());
59
75
  };
60
76
  var isBusinessListActive = listType === ListType.BusinessList;
61
77
  var isCountryListActive = listType === ListType.CountryCodeList;
62
- return (_jsxs(BoxStyled, { children: [_jsx(MIDTitle, { show: !(isBusinessListActive || isCountryListActive), title: t('Welcome to Tap Payments'), description: t('Help us to get your information to start collecting online payments') }), _jsxs(Form, { children: [_jsx(BusinessCountry, { control: control, show: !isCountryListActive, defaultCountry: defaultCountry, countries: businessCountries, onSelect: onSelectBusinessCountry, onOpenBusinessCountryList: function () { return handleMenuListClick(ListType.BusinessList); }, onCloseBusinessCountryList: function () { return handleMenuListClick(); } }), _jsx(Slide, __assign({ direction: 'right', timeout: { exit: 300, appear: 500, enter: 300 }, in: !isNID, mountOnEnter: true, unmountOnExit: true }, { children: _jsx(MobileNumber, { control: control, show: !isBusinessListActive, countries: countriesCode, defaultCountry: defaultCountry, onSwitchToIdNumber: function () { return setIsNID(true); }, onMobileChange: onMobileChange, onSelect: onSelectCountryCode, onOpenCountryList: function () { return handleMenuListClick(ListType.CountryCodeList); }, onCloseCountryList: function () { return handleMenuListClick(); } }) })), _jsx(Slide, __assign({ direction: 'left', in: isNID, timeout: { exit: 300, appear: 500, enter: 300 }, mountOnEnter: true, unmountOnExit: true }, { children: _jsx(IDNumber, { control: control, show: !(isBusinessListActive || isCountryListActive), onSwitchToMobileNumber: function () { return setIsNID(false); }, onIdChange: onNIDChange, onBirthDateChange: onBirthDateChange }) }))] })] }));
78
+ var listActive = isBusinessListActive || isCountryListActive;
79
+ return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('Welcome to Tap Payments'), description: t('Help us to get your information to start collecting online payments') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(BusinessCountry, { show: !isCountryListActive, countries: businessCountries, onListOpen: function () { return handleMenuListClick(ListType.BusinessList); }, onListClose: function () { return handleMenuListClick(); } }), _jsx(Collapse, __assign({ in: !isNID }, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: countriesCode, onSwitchToIdNumber: function () { return setIsNID(true); }, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) })), _jsx(Collapse, __assign({ in: isNID }, { children: _jsx(IDNumber, { show: !listActive, onSwitchToMobileNumber: function () { return setIsNID(false); } }) }))] })), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ isAr: isAr, disabled: !methods.formState.isValid, loading: false }, { children: t('next') })) }))] })) }))] }));
63
80
  };
64
81
  export default React.memo(MID);
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { styled, alpha } from '@mui/material/styles';
15
- import Collapse from '@mui/material/Collapse';
15
+ import Collapse from '../../../../components/Collapse';
16
16
  import Text from '../../../../components/Text';
17
17
  var TitleStyled = styled(Text)(function (_a) {
18
18
  var theme = _a.theme;
@@ -24,6 +24,6 @@ var DescriptionStyled = styled(Text)(function (_a) {
24
24
  });
25
25
  var MIDTitle = function (_a) {
26
26
  var description = _a.description, show = _a.show, title = _a.title;
27
- return (_jsxs(Collapse, __assign({ in: show, unmountOnExit: true, timeout: 500 }, { children: [_jsx(TitleStyled, { children: title }), _jsx(DescriptionStyled, { children: description })] })));
27
+ return (_jsxs(Collapse, __assign({ in: show }, { children: [_jsx(TitleStyled, { children: title }), _jsx(DescriptionStyled, { children: description })] })));
28
28
  };
29
29
  export default React.memo(MIDTitle);
@@ -1,16 +1,11 @@
1
1
  import * as React from 'react';
2
- import { Control } from 'react-hook-form';
3
2
  import { CountryCode } from '../../../../@types';
4
3
  interface MobileNumberProps {
5
4
  countries: Array<CountryCode>;
6
5
  show: boolean;
7
- onSelect?: (country: CountryCode) => void;
8
- defaultCountry?: CountryCode;
9
6
  onSwitchToIdNumber?: () => void;
10
- onMobileChange?: (mobile: string) => void;
11
- onOpenCountryList?: () => void;
12
- onCloseCountryList?: () => void;
13
- control?: Control<any, any>;
7
+ onListOpen?: () => void;
8
+ onListClose?: () => void;
14
9
  }
15
10
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
16
11
  export default _default;
@@ -24,18 +24,21 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
24
24
  import * as React from 'react';
25
25
  import Box from '@mui/material/Box';
26
26
  import { useTranslation } from 'react-i18next';
27
+ import { useController, useFormContext } from 'react-hook-form';
27
28
  import { styled, alpha } from '@mui/material/styles';
28
29
  import Text from '../../../../components/Text';
29
- import Collapse from '@mui/material/Collapse';
30
+ import Collapse from '../../../../components/Collapse';
30
31
  import Tooltip from '@mui/material/Tooltip';
31
32
  import CheckIcon from '@mui/icons-material/Check';
32
- import ClearIcon from '@mui/icons-material/Clear';
33
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
33
+ import ExpandIcon from '../../../../features/shared/ExpandIcon';
34
+ import ClearIcon from '../../../../features/shared/ClearIcon';
35
+ import ScreenContainer from '../../../../features/shared/Containers/ScreenContainer';
34
36
  import Icon from '../../../../components/Icon';
35
- import Input from '../../../../components/Input';
37
+ import Input from '../../../../features/shared/Input';
36
38
  import SimpleList from '../../../../components/SimpleList';
37
- import { ICONS_NAMES, LANGUAGE_MODE } from '../../../../constants';
39
+ import { ICONS_NAMES } from '../../../../constants';
38
40
  import { removeAllCharsFromNumber } from '../../../../utils';
41
+ import { useLanguage } from '../../../../hooks';
39
42
  var IconStyled = styled(Icon)(function (_a) {
40
43
  var theme = _a.theme;
41
44
  return ({
@@ -44,41 +47,20 @@ var IconStyled = styled(Icon)(function (_a) {
44
47
  cursor: 'pointer'
45
48
  });
46
49
  });
47
- var InputStyled = styled(Input)(function (_a) {
48
- var theme = _a.theme;
49
- return ({
50
- padding: theme.spacing(0, 2.5, 0, 2.5)
51
- });
52
- });
53
- var BoxStyled = styled(Box)(function () { return ({
54
- display: 'flex',
55
- flexDirection: 'column'
56
- }); });
57
50
  var LabelContainerStyled = styled(Box)(function (_a) {
58
51
  var theme = _a.theme;
59
52
  return ({
60
53
  display: 'flex',
61
54
  justifyContent: 'space-between',
62
- padding: theme.spacing(0, 2, 1, 2.5)
55
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
63
56
  });
64
57
  });
65
- var InputLabelStyled = styled(Text)(function (_a) {
66
- var theme = _a.theme;
67
- return (__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
68
- });
69
58
  var CountryItemContainer = styled(Box)(function () { return ({
70
59
  display: 'flex'
71
60
  }); });
72
61
  var CountryCodeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
73
62
  var theme = _a.theme, isSelected = _a.isSelected;
74
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
75
- });
76
- var ExpandIcon = styled(ExpandMoreIcon, { shouldForwardProp: function (prop) { return prop !== 'anchorEl'; } })(function (_a) {
77
- var _b;
78
- var theme = _a.theme, anchorEl = _a.anchorEl;
79
- return (__assign(__assign({}, theme.typography.h6), (_b = { display: 'flex', transform: !!anchorEl ? 'rotate(180deg)' : '', paddingInlineStart: !!anchorEl ? theme.spacing(0) : theme.spacing(1), paddingInlineEnd: !!anchorEl ? theme.spacing(1) : theme.spacing(0) }, _b[theme.transitions.create(['transform'])] = {
80
- duration: theme.transitions.duration.standard
81
- }, _b)));
63
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { width: theme.spacing(10), fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
82
64
  });
83
65
  var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
84
66
  var theme = _a.theme, isSelected = _a.isSelected;
@@ -92,85 +74,59 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
92
74
  alignItems: 'flex-end'
93
75
  });
94
76
  });
95
- var ClearIconStyled = styled(ClearIcon)(function (_a) {
96
- var theme = _a.theme;
97
- return ({
98
- width: theme.spacing(2),
99
- height: theme.spacing(2),
100
- cursor: 'pointer',
101
- color: alpha(theme.palette.text.primary, 0.4)
102
- });
103
- });
104
77
  var CountryCodeStyled = styled(Text)(function (_a) {
105
78
  var theme = _a.theme;
106
79
  return (__assign(__assign({ cursor: 'pointer' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightRegular, display: 'flex', alignItems: 'center', minWidth: theme.spacing(8.75) }));
107
80
  });
81
+ var InputLabelStyled = styled(Text)(function (_a) {
82
+ var theme = _a.theme;
83
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
84
+ });
108
85
  var MobileNumber = React.forwardRef(function (_a, ref) {
109
- var countries = _a.countries, onSelect = _a.onSelect, defaultCountry = _a.defaultCountry, rest = __rest(_a, ["countries", "onSelect", "defaultCountry"]);
110
- var _b = React.useState([]), countriesCode = _b[0], setCountriesCode = _b[1];
111
- var _c = React.useState(), selected = _c[0], setSelected = _c[1];
112
- var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
113
- var _e = React.useState(''), mobileValue = _e[0], setMobileValue = _e[1];
114
- var _f = useTranslation(), t = _f.t, i18n = _f.i18n;
115
- var isAR = i18n.language === LANGUAGE_MODE.AR;
86
+ var _b;
87
+ var countries = _a.countries, rest = __rest(_a, ["countries"]);
88
+ var countriesCode = React.useState(countries)[0];
89
+ var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
90
+ var t = useTranslation().t;
91
+ var isAr = useLanguage().isAr;
92
+ var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
93
+ var phoneControl = useController({ name: 'mobile', control: control });
94
+ var countryCodeControl = useController({ name: 'countryCode', control: control });
116
95
  React.useEffect(function () {
117
- setCountriesCode(countries);
96
+ if (phoneControl.field.value) {
97
+ setValue('mobile', phoneControl.field.value, { shouldValidate: true });
98
+ }
99
+ if (countryCodeControl.field.value) {
100
+ setValue('countryCode', countryCodeControl.field.value, { shouldValidate: true });
101
+ }
118
102
  }, []);
119
- React.useEffect(function () {
120
- if (defaultCountry)
121
- setSelected(defaultCountry);
122
- }, [defaultCountry]);
123
103
  var onPhoneNumberChange = function (_a) {
124
- var _b;
125
104
  var target = _a.target;
126
- target.value = removeAllCharsFromNumber(target.value);
127
- (_b = rest.onMobileChange) === null || _b === void 0 ? void 0 : _b.call(rest, target.value);
128
- setMobileValue(target.value);
105
+ var value = removeAllCharsFromNumber(target.value);
106
+ phoneControl.field.onChange(value);
129
107
  };
130
108
  var clearMobileNumber = function () {
131
- var _a;
132
- setMobileValue('');
133
- (_a = rest.onMobileChange) === null || _a === void 0 ? void 0 : _a.call(rest, '');
134
- };
135
- var onCountryCodeSearch = function (e) {
136
- if (e === null || e === void 0 ? void 0 : e.code) {
137
- var searchList = getCountryCodeSearch(countriesCode, e.code);
138
- if (searchList.length === 0 || e.code === 'Backspace')
139
- setCountriesCode(countriesCode);
140
- else
141
- setCountriesCode(searchList);
142
- }
143
- };
144
- var getCountryCodeSearch = function (originalList, searchKey) {
145
- var _a;
146
- return (_a = (originalList || [])) === null || _a === void 0 ? void 0 : _a.filter(function (item) {
147
- return item.name.english.charAt(0).toLowerCase() === searchKey.charAt(searchKey.length - 1).toLowerCase();
148
- });
109
+ phoneControl.field.onChange('');
149
110
  };
150
111
  var onOpenCountryList = function (event) {
151
112
  var _a;
152
113
  setAnchorEl(event.currentTarget);
153
- document.addEventListener('keydown', onCountryCodeSearch, true);
154
- setCountriesCode(countries);
155
- (_a = rest.onOpenCountryList) === null || _a === void 0 ? void 0 : _a.call(rest);
114
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
156
115
  };
157
116
  var onCloseCountryList = function () {
158
117
  var _a;
159
118
  setAnchorEl(null);
160
- document.removeEventListener('keydown', onCountryCodeSearch, true);
161
- setCountriesCode(countries);
162
- (_a = rest.onCloseCountryList) === null || _a === void 0 ? void 0 : _a.call(rest);
119
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
163
120
  };
164
121
  var onSelectItem = function (country) {
165
- setSelected(country);
166
- onSelect && onSelect(country);
167
122
  onCloseCountryList();
123
+ countryCodeControl.field.onChange(country);
168
124
  };
169
- return (_jsx(Collapse, __assign({ in: rest.show, unmountOnExit: true, timeout: 500 }, { children: _jsxs(BoxStyled, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('mobile_number_label') }), _jsx(Collapse, __assign({ in: !anchorEl, timeout: 500, unmountOnExit: true }, { children: _jsx(Tooltip, __assign({ title: t('switch_to_id') }, { children: _jsx(IconStyled, { onClick: rest.onSwitchToIdNumber, alt: 'switcher icon', src: ICONS_NAMES.ID_IMAGE }) })) }))] }), _jsx(InputStyled, { dir: 'ltr', inputProps: { maxLength: (selected === null || selected === void 0 ? void 0 : selected.digits) || 10 }, onChange: onPhoneNumberChange, value: mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: onOpenCountryList }, { children: ["+".concat(selected === null || selected === void 0 ? void 0 : selected.idd_prefix), _jsx(ExpandIcon, { anchorEl: anchorEl })] })), endAdornment: mobileValue && _jsx(ClearIconStyled, { onClick: clearMobileNumber }), placeholder: "".concat((selected === null || selected === void 0 ? void 0 : selected.iso2) === 'SA' ? '5' : '0', "00000000") }), _jsx(Collapse, __assign({ in: !!anchorEl, unmountOnExit: true, timeout: 300 }, { children: _jsx(SimpleList, { list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
170
- return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ sx: { width: function (_a) {
171
- var spacing = _a.spacing;
172
- return spacing(10);
173
- } }, isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (selected === null || selected === void 0 ? void 0 : selected.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (selected === null || selected === void 0 ? void 0 : selected.idd_prefix) }, { children: isAR ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (selected === null || selected === void 0 ? void 0 : selected.idd_prefix) && _jsx(CheckIconStyled, {})] }));
125
+ var mobileValue = phoneControl.field.value;
126
+ var countryCodeValue = countryCodeControl.field.value;
127
+ var error = (_b = phoneControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
128
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('mobile_number_label') }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(Tooltip, __assign({ title: t('switch_to_id') }, { children: _jsx(IconStyled, { onClick: rest.onSwitchToIdNumber, alt: 'switcher icon', src: ICONS_NAMES.ID_IMAGE }) })) }))] }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits) || 10 }, onChange: onPhoneNumberChange, value: mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: onOpenCountryList }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), _jsx(ExpandIcon, { anchorEl: !!anchorEl })] })), endAdornment: mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber }), placeholder: "".concat((countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA' ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: (!anchorEl && error) || '' }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
129
+ return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIconStyled, {})] }));
174
130
  } }) }))] })) })));
175
131
  });
176
132
  export default React.memo(MobileNumber);
@@ -0,0 +1,18 @@
1
+ import * as yup from 'yup';
2
+ export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
6
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
7
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
9
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
+ }>>>;
12
+ export declare const PhoneValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
15
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
16
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
17
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ }>>>;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export var NIDValidationSchema = yup.object().shape({
3
+ dob: yup.string().min(5).required('DOB is required'),
4
+ nid: yup.string().min(8).max(10).required('NID is required')
5
+ });
6
+ export var PhoneValidationSchema = yup.object().shape({
7
+ mobile: yup.string().min(5).required('Phone number is required')
8
+ });
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface BrandNameProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: BrandNameProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,73 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
16
+ import Box from '@mui/material/Box';
17
+ import { styled, alpha } from '@mui/material/styles';
18
+ import InfoIcon from '@mui/icons-material/Info';
19
+ import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import Text from '../../../../components/Text';
22
+ import Input from '../../../shared/Input';
23
+ import ClearIcon from '../../../shared/ClearIcon';
24
+ import Tooltip from '../../../../components/Tooltip';
25
+ import { removeAllOtherThanAlphabet } from '../../../../utils';
26
+ var LabelContainerStyled = styled(Box)(function (_a) {
27
+ var theme = _a.theme;
28
+ return ({
29
+ display: 'flex',
30
+ justifyContent: 'space-between',
31
+ padding: theme.spacing(0, 2.5, 1, 2.5)
32
+ });
33
+ });
34
+ var InputLabelStyled = styled(Text)(function (_a) {
35
+ var theme = _a.theme;
36
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
37
+ });
38
+ var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
39
+ var theme = _a.theme;
40
+ return ({
41
+ width: theme.spacing(2.75),
42
+ height: theme.spacing(2.125),
43
+ cursor: 'pointer',
44
+ color: alpha(theme.palette.text.primary, 0.4)
45
+ });
46
+ });
47
+ var InfoIconStyled = styled(InfoIcon)(function (_a) {
48
+ var theme = _a.theme;
49
+ return ({
50
+ width: theme.spacing(2.75),
51
+ height: theme.spacing(2.125),
52
+ cursor: 'pointer',
53
+ color: alpha(theme.palette.text.primary, 0.4)
54
+ });
55
+ });
56
+ var BrandName = function (_a) {
57
+ var _b;
58
+ var _c = React.useState(false), isHovered = _c[0], setIsHovered = _c[1];
59
+ var t = useTranslation().t;
60
+ var control = useFormContext().control;
61
+ var brandControl = useController({ control: control, name: 'brandName' });
62
+ var handleBrandNameChange = function (_a) {
63
+ var target = _a.target;
64
+ var value = removeAllOtherThanAlphabet(target.value);
65
+ brandControl.field.onChange(value);
66
+ };
67
+ var clearBrandName = function () {
68
+ brandControl.field.onChange('');
69
+ };
70
+ var brandNameValue = brandControl.field.value;
71
+ return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 3 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_description'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue, endAdornment: brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName }), placeholder: t('brand_name_placeholder'), warningType: 'alert', warningMessage: (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message })] })));
72
+ };
73
+ export default React.memo(BrandName);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface MerchantProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: MerchantProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,50 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useForm, FormProvider } from 'react-hook-form';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { yupResolver } from '@hookform/resolvers/yup';
17
+ import { useAppDispatch } from '../../../../hooks';
18
+ import { handleNextScreenStep } from '../../../../app/settings';
19
+ import Form from '../../../../components/Form';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import Button from '../../../shared/Button';
22
+ import { useLanguage } from '../../../../hooks';
23
+ import { MerchantValidationSchema } from './validation';
24
+ import BrandName from './BrandName';
25
+ import SocialMedia from './SocialMedia';
26
+ import TAC from './TAC';
27
+ var Merchant = function (_a) {
28
+ var methods = useForm({
29
+ resolver: yupResolver(MerchantValidationSchema),
30
+ defaultValues: {
31
+ brandName: '',
32
+ termAndConditionChecked: false,
33
+ links: {
34
+ website: '',
35
+ twitter: '',
36
+ instagram: ''
37
+ }
38
+ },
39
+ mode: 'onChange'
40
+ });
41
+ var t = useTranslation().t;
42
+ var isAr = useLanguage().isAr;
43
+ var dispatch = useAppDispatch();
44
+ var onSubmit = function (data) {
45
+ console.log('data', data);
46
+ dispatch(handleNextScreenStep());
47
+ };
48
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, {}), _jsx(SocialMedia, {}), _jsx(TAC, {}), _jsx(Button, __assign({ disabled: !methods.formState.isValid, isAr: isAr }, { children: t('next') }))] })) })) }));
49
+ };
50
+ export default React.memo(Merchant);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface SocialMediaProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: SocialMediaProps) => JSX.Element>;
5
+ export default _default;