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

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 (308) hide show
  1. package/build/@types/app.d.ts +50 -20
  2. package/build/@types/app.js +9 -3
  3. package/build/@types/form.d.ts +21 -12
  4. package/build/api/auth.d.ts +28 -5
  5. package/build/api/auth.js +36 -1
  6. package/build/api/axios.js +2 -2
  7. package/build/api/brand.d.ts +2 -1
  8. package/build/api/brand.js +10 -1
  9. package/build/api/country.d.ts +3 -1
  10. package/build/api/country.js +3 -1
  11. package/build/api/data.d.ts +38 -7
  12. package/build/api/data.js +57 -17
  13. package/build/api/entity.d.ts +51 -5
  14. package/build/api/entity.js +39 -9
  15. package/build/api/firebase.d.ts +1 -1
  16. package/build/api/firebase.js +3 -1
  17. package/build/api/index.d.ts +44 -14
  18. package/build/api/individual.d.ts +76 -19
  19. package/build/api/individual.js +29 -2
  20. package/build/api/lead.d.ts +9 -6
  21. package/build/api/lead.js +8 -1
  22. package/build/app/rootReducer.d.ts +0 -1
  23. package/build/app/rootReducer.js +0 -2
  24. package/build/app/settings.d.ts +9 -2
  25. package/build/app/settings.js +22 -11
  26. package/build/app/store.d.ts +0 -2
  27. package/build/assets/locales/ar.json +258 -183
  28. package/build/assets/locales/en.json +190 -108
  29. package/build/components/AnimationFlow/AnimationFlow.d.ts +4 -1
  30. package/build/components/AnimationFlow/AnimationFlow.js +6 -8
  31. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  32. package/build/components/AnimationFlow/BottomSheet.js +4 -3
  33. package/build/components/AnimationFlow/Dialog.d.ts +4 -1
  34. package/build/components/AnimationFlow/Dialog.js +5 -3
  35. package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
  36. package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
  37. package/build/components/ArabicDatePicker/index.d.ts +2 -0
  38. package/build/components/ArabicDatePicker/index.js +2 -0
  39. package/build/components/ArabicDatePicker/style.css +24 -0
  40. package/build/components/FileInput/DragAndDrop.d.ts +10 -1
  41. package/build/components/FileInput/DragAndDrop.js +108 -8
  42. package/build/components/Lottie/Lottie.d.ts +878 -0
  43. package/build/components/Lottie/Lottie.js +58 -0
  44. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  45. package/build/components/Lottie/files/success.json +425 -0
  46. package/build/components/Lottie/index.d.ts +3 -0
  47. package/build/components/Lottie/index.js +3 -0
  48. package/build/components/OTPField/OTPField.d.ts +2 -1
  49. package/build/components/OTPField/OTPField.js +2 -2
  50. package/build/components/OTPTimer/OTPTimer.js +1 -1
  51. package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
  52. package/build/components/ProgressBar/CircularProgressBar.js +48 -0
  53. package/build/components/ProgressBar/index.d.ts +2 -0
  54. package/build/components/ProgressBar/index.js +2 -0
  55. package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
  56. package/build/components/RadioLabel/RadioLabel.js +2 -2
  57. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -6
  58. package/build/components/SocialMediaGroup/SocialMediaGroup.js +4 -49
  59. package/build/constants/api.d.ts +6 -0
  60. package/build/constants/api.js +14 -1
  61. package/build/constants/app.d.ts +5 -5
  62. package/build/constants/app.js +62 -32
  63. package/build/constants/assets.d.ts +14 -0
  64. package/build/constants/assets.js +16 -2
  65. package/build/constants/dummy.d.ts +1 -1
  66. package/build/constants/dummy.js +2 -2
  67. package/build/constants/validation.d.ts +10 -0
  68. package/build/constants/validation.js +11 -1
  69. package/build/features/app/auth/authStore.d.ts +30 -4
  70. package/build/features/app/auth/authStore.js +182 -20
  71. package/build/features/app/bank/bankStore.d.ts +16 -0
  72. package/build/features/app/bank/bankStore.js +88 -41
  73. package/build/features/app/business/businessStore.d.ts +22 -3
  74. package/build/features/app/business/businessStore.js +445 -296
  75. package/build/features/app/connect/connectStore.d.ts +34 -31
  76. package/build/features/app/connect/connectStore.js +427 -300
  77. package/build/features/app/entity/entityStore.d.ts +40 -8
  78. package/build/features/app/entity/entityStore.js +389 -149
  79. package/build/features/app/individual/individualStore.d.ts +18 -0
  80. package/build/features/app/individual/individualStore.js +178 -85
  81. package/build/features/app/password/passwordStore.d.ts +1 -7
  82. package/build/features/app/password/passwordStore.js +31 -20
  83. package/build/features/app/tax/taxStore.js +23 -16
  84. package/build/features/auth/Auth.d.ts +2 -1
  85. package/build/features/auth/Auth.js +37 -9
  86. package/build/features/auth/screens/NID/DOB.d.ts +7 -0
  87. package/build/features/auth/screens/NID/DOB.js +47 -0
  88. package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
  89. package/build/features/auth/screens/NID/IDNumber.js +64 -0
  90. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  91. package/build/features/auth/screens/NID/NID.js +68 -0
  92. package/build/features/auth/screens/NID/TAC.d.ts +3 -0
  93. package/build/features/auth/screens/NID/TAC.js +87 -0
  94. package/build/features/auth/screens/NID/index.d.ts +3 -0
  95. package/build/features/auth/screens/NID/index.js +2 -0
  96. package/build/features/auth/screens/NID/validation.d.ts +27 -0
  97. package/build/features/auth/screens/NID/validation.js +19 -0
  98. package/build/features/auth/screens/OTP/OTP.js +8 -4
  99. package/build/features/auth/screens/OTP/OTPInput.js +9 -2
  100. package/build/features/bank/Bank.js +4 -4
  101. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
  102. package/build/features/bank/screens/BankDetails/BankName.js +2 -1
  103. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  104. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  105. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  106. package/build/features/bank/screens/Success/Success.js +7 -3
  107. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
  108. package/build/features/business/Business.js +4 -4
  109. package/build/features/business/screens/Activities/Activities.js +16 -17
  110. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  111. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  112. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  113. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  114. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  115. package/build/features/business/screens/Activities/validation.js +0 -9
  116. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  117. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  118. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  119. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  120. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  121. package/build/features/business/screens/BusinessType/LicenseList.js +26 -7
  122. package/build/features/business/screens/BusinessType/LicenseNumber.js +12 -6
  123. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  124. package/build/features/business/screens/BusinessType/LicenseType.js +78 -0
  125. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  126. package/build/features/business/screens/BusinessType/validation.js +52 -3
  127. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  128. package/build/features/business/screens/CivilID/CivilID.js +67 -0
  129. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  130. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  131. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  132. package/build/features/business/screens/CivilID/index.js +2 -0
  133. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  134. package/build/features/business/screens/CivilID/validation.js +4 -0
  135. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  136. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  137. package/build/features/business/screens/Customers/Customers.js +15 -9
  138. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  139. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  140. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  141. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  142. package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
  143. package/build/features/business/screens/OTP/OTP.js +15 -2
  144. package/build/features/business/screens/Success/Success.js +10 -3
  145. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -10
  146. package/build/features/business/screens/Verify/Verify.js +4 -4
  147. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  148. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
  149. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  150. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  151. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  152. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  153. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  154. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  155. package/build/features/connect/Connect.d.ts +1 -0
  156. package/build/features/connect/Connect.js +38 -10
  157. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  158. package/build/features/connect/screens/CivilID/CivilID.js +102 -0
  159. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  160. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  161. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  162. package/build/features/connect/screens/CivilID/index.js +2 -0
  163. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  164. package/build/features/connect/screens/CivilID/validation.js +4 -0
  165. package/build/features/connect/screens/Individual/Email.js +11 -3
  166. package/build/features/connect/screens/Individual/Individual.js +48 -28
  167. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  168. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  169. package/build/features/connect/screens/Merchant/Merchant.js +41 -64
  170. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
  171. package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
  172. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  173. package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
  174. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  175. package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
  176. package/build/features/connect/screens/Merchant/validation.js +108 -173
  177. package/build/features/connect/screens/Mobile/Mobile.js +33 -12
  178. package/build/features/connect/screens/NID/NID.js +5 -1
  179. package/build/features/connect/screens/OTP/OTP.js +20 -6
  180. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  181. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  182. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  183. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  184. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  185. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  186. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  187. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  188. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  189. package/build/features/entity/Entity.js +6 -6
  190. package/build/features/entity/screens/Customers/CustomerLocations.d.ts +118 -0
  191. package/build/features/entity/screens/Customers/CustomerLocations.js +171 -0
  192. package/build/features/entity/screens/Customers/Customers.d.ts +5 -0
  193. package/build/features/entity/screens/Customers/Customers.js +90 -0
  194. package/build/features/entity/screens/Customers/ExpectedCustomers.d.ts +8 -0
  195. package/build/features/entity/screens/Customers/ExpectedCustomers.js +98 -0
  196. package/build/features/entity/screens/Customers/ExpectedSalesRange.d.ts +8 -0
  197. package/build/features/entity/screens/Customers/ExpectedSalesRange.js +127 -0
  198. package/build/features/entity/screens/Customers/RefundPolicy.d.ts +36 -0
  199. package/build/features/entity/screens/Customers/RefundPolicy.js +84 -0
  200. package/build/features/entity/screens/Customers/TransactionPolicy.d.ts +3 -0
  201. package/build/features/entity/screens/Customers/TransactionPolicy.js +44 -0
  202. package/build/features/entity/screens/Customers/index.d.ts +3 -0
  203. package/build/features/entity/screens/Customers/index.js +2 -0
  204. package/build/features/entity/screens/Customers/validation.d.ts +20 -0
  205. package/build/features/entity/screens/Customers/validation.js +13 -0
  206. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +2 -1
  207. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +25 -15
  208. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
  209. package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
  210. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +38 -10
  211. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
  212. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
  213. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +34 -5
  214. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
  215. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +75 -41
  216. package/build/features/entity/screens/EntityInfoConfirm/validation.js +76 -10
  217. package/build/features/entity/screens/Success/Success.js +7 -3
  218. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -8
  219. package/build/features/entity/screens/Verify/Verify.js +18 -5
  220. package/build/features/featuresScreens.d.ts +0 -1
  221. package/build/features/featuresScreens.js +30 -7
  222. package/build/features/individual/Individual.js +4 -4
  223. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
  224. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  225. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  226. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  227. package/build/features/individual/screens/Success/Success.js +7 -3
  228. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
  229. package/build/features/individual/screens/Verify/Verify.js +18 -5
  230. package/build/features/password/Password.js +4 -4
  231. package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
  232. package/build/features/password/screens/OTP/OTP.js +15 -2
  233. package/build/features/password/screens/Success/Success.js +7 -3
  234. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -12
  235. package/build/features/password/screens/Verify/Verify.js +16 -3
  236. package/build/features/shared/Background/Background.d.ts +2 -5
  237. package/build/features/shared/Background/Background.js +7 -3
  238. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  239. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  240. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  241. package/build/features/shared/Button/MobileButton.js +2 -2
  242. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  243. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  244. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  245. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  246. package/build/features/shared/Dialog/index.d.ts +4 -0
  247. package/build/features/shared/Dialog/index.js +4 -0
  248. package/build/features/shared/Input/Input.d.ts +1 -1
  249. package/build/features/shared/Input/Input.js +2 -2
  250. package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -2
  251. package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
  252. package/build/features/shared/UploadFile/UploadFile.js +24 -9
  253. package/build/features/signIn/SignIn.js +4 -4
  254. package/build/features/signIn/screens/Email/Email.js +4 -2
  255. package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
  256. package/build/features/signIn/screens/OTP/OTP.js +14 -1
  257. package/build/features/signIn/screens/Password/Password.js +15 -2
  258. package/build/features/tax/Tax.js +6 -6
  259. package/build/features/tax/screens/Success/Success.js +9 -3
  260. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -10
  261. package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
  262. package/build/features/tax/screens/Verify/Verify.js +16 -3
  263. package/build/hooks/index.d.ts +2 -0
  264. package/build/hooks/index.js +2 -0
  265. package/build/hooks/useAppConfig.d.ts +3 -1
  266. package/build/hooks/useAppConfig.js +2 -2
  267. package/build/hooks/useAppDispatch.d.ts +0 -1
  268. package/build/hooks/useErrorListener.js +0 -6
  269. package/build/hooks/useScreen.d.ts +3 -0
  270. package/build/hooks/useScreen.js +14 -0
  271. package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
  272. package/build/hooks/useSetFromDefaultValues.js +24 -0
  273. package/build/index.d.ts +2 -3
  274. package/build/index.js +1 -4
  275. package/build/utils/array.d.ts +49 -1
  276. package/build/utils/array.js +58 -0
  277. package/build/utils/common.d.ts +1 -0
  278. package/build/utils/common.js +3 -0
  279. package/build/utils/device.d.ts +1 -0
  280. package/build/utils/device.js +13 -0
  281. package/build/utils/index.d.ts +1 -0
  282. package/build/utils/index.js +1 -0
  283. package/build/utils/locale.js +1 -1
  284. package/build/utils/object.d.ts +1 -0
  285. package/build/utils/object.js +12 -0
  286. package/build/utils/string.d.ts +13 -0
  287. package/build/utils/string.js +71 -1
  288. package/build/utils/validation.d.ts +2 -0
  289. package/build/utils/validation.js +6 -0
  290. package/package.json +4 -3
  291. package/build/features/app/otp/otpStore.d.ts +0 -28
  292. package/build/features/app/otp/otpStore.js +0 -153
  293. package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
  294. package/build/features/business/screens/Activities/SalesChannels.js +0 -112
  295. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
  296. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
  297. package/build/features/otp/OTP.d.ts +0 -7
  298. package/build/features/otp/OTP.js +0 -58
  299. package/build/features/otp/index.d.ts +0 -0
  300. package/build/features/otp/index.js +0 -1
  301. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  302. package/build/features/otp/screens/OTPVerify/OTPInput.js +0 -47
  303. package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
  304. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  305. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  306. package/build/features/otp/screens/OTPVerify/index.js +0 -2
  307. package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
  308. package/build/features/otp/screens/OTPVerify/validation.js +0 -4
@@ -50,13 +50,13 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { hasKey } from '../../../utils';
53
- import { handleNextScreenStep, handleCurrentActiveScreen } from '../../../app/settings';
53
+ import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2 } from '../../../app/settings';
54
54
  import { BUSINESS_FLOW_SUCCESS, TAX_STEP_NAMES } from '../../../constants';
55
55
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, data, boardData, boardInfoData, info, hasTaxCompleted;
57
- var _a, _b;
58
- return __generator(this, function (_c) {
59
- switch (_c.label) {
56
+ var payload, data, boardData, boardInfoData, info, countryIso2, hasTaxCompleted;
57
+ var _a, _b, _c;
58
+ return __generator(this, function (_d) {
59
+ switch (_d.label) {
60
60
  case 0:
61
61
  payload = {
62
62
  service_name: 'tap_email',
@@ -64,20 +64,23 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (to
64
64
  };
65
65
  return [4, API.leadService.verifyLeadToken(payload)];
66
66
  case 1:
67
- data = (_c.sent()).data;
67
+ data = (_d.sent()).data;
68
68
  boardInfoData = undefined;
69
69
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
70
70
  if (!(!!data.id && !!data.board_info_id)) return [3, 3];
71
71
  return [4, API.boardService.retrieveBoardInfo({ id: data.id, infoId: data.board_info_id })];
72
72
  case 2:
73
- boardInfoData = _c.sent();
74
- _c.label = 3;
73
+ boardInfoData = _d.sent();
74
+ _d.label = 3;
75
75
  case 3:
76
- info = boardInfoData.info;
76
+ info = (boardInfoData || {}).info;
77
77
  return [4, API.boardService.retrieveBoardDetails(data === null || data === void 0 ? void 0 : data.id)];
78
78
  case 4:
79
- boardData = _c.sent();
80
- hasTaxCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'tax'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
79
+ boardData = _d.sent();
80
+ countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
81
+ if (countryIso2)
82
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
83
+ hasTaxCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'tax'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
81
84
  if (hasTaxCompleted) {
82
85
  thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
83
86
  }
@@ -87,10 +90,10 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (to
87
90
  else if (data.step_name === TAX_STEP_NAMES.TAX_INFO) {
88
91
  thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
89
92
  }
90
- _c.label = 5;
93
+ _d.label = 5;
91
94
  case 5: return [2, {
92
95
  data: data,
93
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info), entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
96
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []), entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
94
97
  token: token
95
98
  }];
96
99
  }
@@ -207,7 +210,7 @@ export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function
207
210
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
208
211
  thunkApi.dispatch(handleNextScreenStep());
209
212
  return [2, {
210
- response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info), user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
213
+ response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((data === null || data === void 0 ? void 0 : data.info) || []), user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
211
214
  formData: params
212
215
  }];
213
216
  }
@@ -257,8 +260,9 @@ export var taxSlice = createSlice({
257
260
  state.error = description;
258
261
  return;
259
262
  }
260
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user.name, bank_account: bank_account, vatID: vatID, merchant: merchant });
263
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user === null || user === void 0 ? void 0 : user.names, bank_account: bank_account, vatID: vatID, merchant: merchant });
261
264
  state.data.verify.token = token;
265
+ state.data.taxData.vatId = vatID;
262
266
  })
263
267
  .addCase(verifyLeadToken.pending, function (state) {
264
268
  state.error = null;
@@ -350,6 +354,7 @@ export var taxSlice = createSlice({
350
354
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
351
355
  var _a;
352
356
  state.loading = false;
357
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateBoardSuccessLoading: false });
353
358
  state.error = null;
354
359
  var response = (action.payload || {}).response;
355
360
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -358,14 +363,16 @@ export var taxSlice = createSlice({
358
363
  return;
359
364
  }
360
365
  var flows = response.flows, steps = response.steps, user = response.user, bank_account = response.bank_account, vatID = response.vatID, merchant = response.merchant;
361
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account, name: user.name, vatID: vatID, merchant: merchant });
366
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account, name: user === null || user === void 0 ? void 0 : user.names, vatID: vatID, merchant: merchant });
362
367
  })
363
368
  .addCase(updateLeadSuccess.pending, function (state) {
364
369
  state.loading = true;
370
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateBoardSuccessLoading: true });
365
371
  state.error = null;
366
372
  })
367
373
  .addCase(updateLeadSuccess.rejected, function (state, action) {
368
374
  state.loading = false;
375
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateBoardSuccessLoading: false });
369
376
  state.error = action.error.message;
370
377
  });
371
378
  }
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { LibConfig } from '../../@types';
3
3
  export interface AuthLibProps extends LibConfig {
4
- leadId: string;
5
4
  postURL: string;
5
+ leadId: string;
6
+ onClose?: () => void;
6
7
  }
7
8
  export declare function AuthLib(props: AuthLibProps): JSX.Element;
8
9
  export declare function renderAuthLib(config: AuthLibProps, elementId: string): void;
@@ -9,33 +9,61 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
13
24
  import { memo, useEffect } from 'react';
14
25
  import { FeatureContainer } from '../shared/Containers';
15
- import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
16
- import { settingsSelector } from '../../app/settings';
26
+ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
27
+ import { settingsSelector, handleOpen } from '../../app/settings';
17
28
  import AnimationFlow from '../../components/AnimationFlow';
18
29
  import { store } from '../../app/store';
19
- import { authSelector } from '../app/auth/authStore';
30
+ import { authSelector, retrieveLead, storeLeadId, storePostUrl } from '../app/auth/authStore';
20
31
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
21
32
  import Collapse from '../../components/Collapse';
22
33
  import { reactElement, removeElement } from '../../utils';
23
34
  import { AUTH_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
24
35
  import { authFeatureScreens } from '../featuresScreens';
25
36
  import Background from '../shared/Background';
26
- var Auth = memo(function (props) {
37
+ var Auth = memo(function (_a) {
38
+ var onClose = _a.onClose, props = __rest(_a, ["onClose"]);
27
39
  var theme = useAppTheme().theme;
28
- var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
29
- var authError = useAppSelector(authSelector).error;
30
- useAppConfig(__assign({ navigation: AUTH_SCREENS_NAVIGATION }, props));
40
+ var dispatch = useAppDispatch();
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
+ var _c = useAppSelector(authSelector), authError = _c.error, customLoading = _c.customLoading, loading = _c.loading;
43
+ useAppConfig(__assign({ navigation: AUTH_SCREENS_NAVIGATION, disableCountries: true, disableLocale: true }, props));
31
44
  useErrorListener(authError || error);
32
45
  useStepStartedListener();
33
46
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
34
47
  useEffect(function () {
35
48
  if (!props.leadId)
36
49
  throw new Error('leadId is required');
50
+ var _a = props || {}, leadId = _a.leadId, postURL = _a.postURL;
51
+ var data = {
52
+ postUrl: postURL
53
+ };
54
+ if (!props.open)
55
+ return;
56
+ dispatch(storePostUrl(data));
57
+ dispatch(storeLeadId({ leadId: leadId }));
37
58
  }, []);
38
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading, sx: { position: 'absolute' } }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(_Fragment, {}), screenId: activeScreen.name, animationType: 'collapse' }, { children: _jsx(FeatureContainer, { children: authFeatureScreens.map(function (_a, index) {
59
+ useEffect(function () {
60
+ if (data.isValidOperator && props.open)
61
+ dispatch(retrieveLead(props.leadId));
62
+ }, [data.isValidOperator]);
63
+ var handleDialogClose = function () {
64
+ dispatch(handleOpen(false));
65
+ };
66
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onClose: onClose, onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, footer: _jsx(_Fragment, {}), screenId: activeScreen.name, animationType: 'collapse' }, { children: _jsx(FeatureContainer, { children: authFeatureScreens.map(function (_a, index) {
39
67
  var Element = _a.element, name = _a.name;
40
68
  var isActive = activeScreen.name === name;
41
69
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -54,6 +82,6 @@ export function unmountAuthLib(elementId, unmountTimeout) {
54
82
  var _a;
55
83
  ((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
56
84
  removeElement(DIALOG_ID);
57
- reactElement(elementId).unmount();
85
+ elementId && reactElement(elementId).unmount();
58
86
  }, unmountTimeout);
59
87
  }
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ interface DOBProps {
3
+ show: boolean;
4
+ onDateClicked?: (flag: boolean) => void;
5
+ }
6
+ declare const DOB: ({ show, onDateClicked }: DOBProps) => JSX.Element;
7
+ export default DOB;
@@ -0,0 +1,47 @@
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 { useTranslation } from 'react-i18next';
14
+ import { useController, useFormContext } from 'react-hook-form';
15
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
16
+ import { ScreenContainer } from '../../../shared/Containers';
17
+ import DatePicker from '../../../../components/DatePicker';
18
+ import { alpha, styled } from '@mui/material/styles';
19
+ import { clearError, authSelector } from '../../../app/auth/authStore';
20
+ import Text from '../../../../components/Text';
21
+ import Collapse from '../../../../components/Collapse';
22
+ var InputLabelStyled = styled(Text)(function (_a) {
23
+ var theme = _a.theme;
24
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
25
+ });
26
+ var DOB = function (_a) {
27
+ var show = _a.show, onDateClicked = _a.onDateClicked;
28
+ var t = useTranslation().t;
29
+ var control = useFormContext().control;
30
+ var dispatch = useAppDispatch();
31
+ var dobControl = useController({ control: control, name: 'dob' });
32
+ var error = useAppSelector(authSelector).error;
33
+ var handleBirthDateChange = function (data) {
34
+ dobControl.field.onChange(data);
35
+ handleClearError();
36
+ };
37
+ var handleClearError = function () {
38
+ if (error)
39
+ dispatch(clearError());
40
+ };
41
+ var dateValue = dobControl.field.value;
42
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
43
+ var spacing = _a.spacing;
44
+ return spacing(2.5, 2.5, 1.5, 2.5);
45
+ } } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange, onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); } })] }) })));
46
+ };
47
+ export default DOB;
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.RefAttributes<unknown>>>;
3
+ export default _default;
@@ -0,0 +1,64 @@
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useAppSelector } from '../../../../hooks';
15
+ import Box from '@mui/material/Box';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { useController, useFormContext } from 'react-hook-form';
18
+ import { styled, alpha } from '@mui/material/styles';
19
+ import Text from '../../../../components/Text';
20
+ import Input from '../../../shared/Input';
21
+ import CheckIcon from '../../../shared/CheckIcon';
22
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
+ import { ID_NUMBER_LENGTH } from '../../../../constants';
24
+ import { authSelector } from '../../../app/auth/authStore';
25
+ import ClearIcon from '../../../shared/ClearIcon';
26
+ import { removeAllCharsFromNumber } from '../../../../utils';
27
+ var LabelContainerStyled = styled(Box)(function (_a) {
28
+ var theme = _a.theme;
29
+ return ({
30
+ display: 'flex',
31
+ justifyContent: 'space-between',
32
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
33
+ });
34
+ });
35
+ var InputLabelStyled = styled(Text)(function (_a) {
36
+ var theme = _a.theme;
37
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
38
+ });
39
+ var IDNumber = React.forwardRef(function (_a, ref) {
40
+ var _b, _c;
41
+ var t = useTranslation().t;
42
+ var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
43
+ var nidControl = useController({ control: control, name: 'nid' });
44
+ var data = useAppSelector(authSelector).data;
45
+ var responseBody = data.responseBody;
46
+ var defaultNid = (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _b === void 0 ? void 0 : _b.id;
47
+ React.useEffect(function () {
48
+ if (nidControl.field.value)
49
+ setValue('nid', nidControl.field.value, { shouldValidate: true });
50
+ }, []);
51
+ var handleIdChange = function (_a) {
52
+ var target = _a.target;
53
+ var value = removeAllCharsFromNumber(target.value);
54
+ nidControl.field.onChange(value);
55
+ };
56
+ var clearIdNumber = function () {
57
+ nidControl.field.onChange('');
58
+ };
59
+ var nidValue = nidControl.field.value;
60
+ var error = (_c = nidControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
61
+ var readOnly = !!defaultNid;
62
+ return (_jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', readOnly: readOnly, inputProps: { maxLength: ID_NUMBER_LENGTH }, value: nidValue, onChange: handleIdChange, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : readOnly ? _jsx(_Fragment, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })));
63
+ });
64
+ export default React.memo(IDNumber);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface NIDProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: NIDProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,68 @@
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 { styled } from '@mui/material/styles';
16
+ import { useForm, FormProvider } from 'react-hook-form';
17
+ import { yupResolver } from '@hookform/resolvers/yup';
18
+ import { NIDValidationSchema, NIDDOBValidationSchema } from './validation';
19
+ import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
20
+ import { settingsSelector } from '../../../../app/settings';
21
+ import { clearError, authSelector, createAuth } from '../../../app/auth/authStore';
22
+ import Form from '../../../../components/Form';
23
+ import Button from '../../../shared/Button';
24
+ import { ScreenContainer } from '../../../shared/Containers';
25
+ import Collapse from '../../../../components/Collapse';
26
+ import IDNumber from './IDNumber';
27
+ import TAC from './TAC';
28
+ import DOB from './DOB';
29
+ var FormStyled = styled(Form)(function () { return ({
30
+ display: 'flex',
31
+ flexDirection: 'column'
32
+ }); });
33
+ var NID = function (_a) {
34
+ var isAr = useLanguage().isAr;
35
+ var dispatch = useAppDispatch();
36
+ var t = useTranslation().t;
37
+ var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
38
+ var _c = useAppSelector(authSelector), data = _c.data, loading = _c.loading, error = _c.error;
39
+ var settingsStore = useAppSelector(settingsSelector);
40
+ var nid = data.nid, dob = data.dob, termAndConditionChecked = data.termAndConditionChecked, responseBody = data.responseBody;
41
+ var isDobAvailable = responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth;
42
+ var methods = useForm({
43
+ resolver: yupResolver(!isDobAvailable ? NIDDOBValidationSchema : NIDValidationSchema),
44
+ defaultValues: {
45
+ nid: nid,
46
+ dob: dob,
47
+ termAndConditionChecked: termAndConditionChecked
48
+ },
49
+ mode: 'onChange'
50
+ });
51
+ useSetFromDefaultValues(methods, { nid: nid, dob: dob, termAndConditionChecked: termAndConditionChecked });
52
+ React.useEffect(function () {
53
+ handleClearError();
54
+ }, [methods.formState.isValid]);
55
+ var onSubmit = function (data) {
56
+ dispatch(createAuth(data));
57
+ };
58
+ var handleCollapseOpenClose = function (flag) {
59
+ setCollapse(flag);
60
+ };
61
+ var handleClearError = function () {
62
+ if (error)
63
+ dispatch(clearError());
64
+ };
65
+ var disabled = !methods.formState.isValid || !!error;
66
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, {}) })), _jsx(DOB, { show: !isDobAvailable, onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(TAC, {}), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
67
+ };
68
+ export default React.memo(NID);
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,87 @@
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 Link from '@mui/material/Link';
19
+ import CheckBox from '../../../../components/CheckBox';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import Text from '../../../../components/Text';
22
+ import Warning from '../../../../components/Warning';
23
+ import { useLanguage } from '../../../../hooks';
24
+ import Collapse from '../../../../components/Collapse';
25
+ import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
26
+ import { settingsSelector } from '../../../../app/settings';
27
+ import { useAppSelector } from '../../../../hooks';
28
+ import { authSelector } from '../../../../features/app/auth/authStore';
29
+ var TACContainerStyled = styled(Box)(function (_a) {
30
+ var theme = _a.theme;
31
+ return ({
32
+ display: 'flex',
33
+ flexDirection: 'row',
34
+ alignItems: 'center',
35
+ paddingInlineStart: theme.spacing(2.5)
36
+ });
37
+ });
38
+ var TextStyled = styled(Text)(function (_a) {
39
+ var theme = _a.theme;
40
+ return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre-line', height: 'fit-content' }, theme.typography.body2));
41
+ });
42
+ var LinkStyled = styled(Link)(function (_a) {
43
+ var theme = _a.theme;
44
+ return ({
45
+ color: theme.palette.primary.main,
46
+ fontWeight: theme.typography.fontWeightMedium,
47
+ letterSpacing: theme.spacing(0)
48
+ });
49
+ });
50
+ var CheckboxStyled = styled(CheckBox)(function (_a) {
51
+ var theme = _a.theme;
52
+ return ({
53
+ margin: theme.spacing(0),
54
+ padding: theme.spacing(0),
55
+ marginInlineEnd: theme.spacing(1.5),
56
+ color: theme.palette.primary.main,
57
+ '& .MuiSvgIcon-root': {
58
+ fontSize: theme.spacing(3.75)
59
+ },
60
+ '&.Mui-checked': {
61
+ color: theme.palette.text.primary,
62
+ borderRadius: theme.spacing(2.5)
63
+ }
64
+ });
65
+ });
66
+ var CollapseStyled = styled(Collapse)(function () { return ({
67
+ width: '100%'
68
+ }); });
69
+ var TAC = function () {
70
+ var _a, _b;
71
+ var t = useTranslation().t;
72
+ var isAr = useLanguage().isAr;
73
+ var control = useFormContext().control;
74
+ var settingsData = useAppSelector(settingsSelector).data;
75
+ var data = useAppSelector(authSelector).data;
76
+ var tacControl = useController({ control: control, name: 'termAndConditionChecked' });
77
+ var tacChecked = tacControl.field.value;
78
+ var warningMessage = (_a = tacControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
79
+ var countryCode = ((_b = data.countryISOCode) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || settingsData.businessCountry.iso2.toLowerCase();
80
+ var handleTACCheckedChange = function (event, checked) {
81
+ tacControl.field.onChange(checked);
82
+ };
83
+ return (_jsxs(ScreenContainer, __assign({ sx: { mt: 3, mb: 1.625 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr
84
+ ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR
85
+ : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })));
86
+ };
87
+ export default React.memo(TAC);
@@ -0,0 +1,3 @@
1
+ import NID, { NIDProps } from './NID';
2
+ export type { NIDProps };
3
+ export default NID;
@@ -0,0 +1,2 @@
1
+ import NID from './NID';
2
+ export default NID;
@@ -0,0 +1,27 @@
1
+ import * as yup from 'yup';
2
+ export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ dob: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
6
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ dob: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
10
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
+ dob: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
13
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
14
+ }>>>;
15
+ export declare const NIDDOBValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
16
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
17
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
19
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
20
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
22
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
23
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
25
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
26
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
27
+ }>>>;
@@ -0,0 +1,19 @@
1
+ import * as yup from 'yup';
2
+ export var NIDValidationSchema = yup.object().shape({
3
+ nid: yup
4
+ .string()
5
+ .matches(/^(1|2)([0-9]{1,})$/g, 'signup_invalid_national_id_format')
6
+ .min(10, 'signup_invalid_national_id')
7
+ .required('signup_invalid_national_id'),
8
+ dob: yup.string().optional(),
9
+ termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond')
10
+ });
11
+ export var NIDDOBValidationSchema = yup.object().shape({
12
+ nid: yup
13
+ .string()
14
+ .matches(/^(1|2)([0-9]{1,})$/g, 'signup_invalid_national_id_format')
15
+ .min(10, 'signup_invalid_national_id')
16
+ .required('signup_invalid_national_id'),
17
+ dob: yup.string().min(5).required('enter_valid_birth_date'),
18
+ termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond')
19
+ });
@@ -15,13 +15,14 @@ import { styled } from '@mui/material/styles';
15
15
  import * as React from 'react';
16
16
  import { useTranslation } from 'react-i18next';
17
17
  import Text from '../../../../components/Text';
18
- import { clearError, authSelector, resetOTPScreen, verifyAuth } from '../../../app/auth/authStore';
18
+ import { clearError, authSelector, resetOTPScreen, verifyAuthOTP } from '../../../app/auth/authStore';
19
19
  import Button from '../../../shared/Button';
20
20
  import { ScreenContainer } from '../../../shared/Containers';
21
21
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
22
  import { useLanguage } from '../../../../hooks';
23
23
  import { useForm, FormProvider } from 'react-hook-form';
24
24
  import { yupResolver } from '@hookform/resolvers/yup';
25
+ import { handlePrevScreenStep } from '../../../../app/settings';
25
26
  import Form from '../../../../components/Form';
26
27
  import { maskPhone } from '../../../../utils';
27
28
  import { OTPValidation } from './validation';
@@ -63,10 +64,13 @@ var OTP = function () {
63
64
  };
64
65
  }, [methods.formState.isValid]);
65
66
  var onSubmit = function (formData) {
66
- dispatch(verifyAuth(formData));
67
+ dispatch(verifyAuthOTP(formData));
68
+ };
69
+ var onBack = function () {
70
+ dispatch(handlePrevScreenStep());
67
71
  };
68
72
  var disabled = !methods.formState.isValid || !!error;
69
- var phone = data.mobileNumber || '+966 522556154';
70
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disabled: disabled, disableBack: true, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
73
+ var phone = data.nid;
74
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('opt_nid_sent_title', { provider: 'ABSHER' }), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disabled: disabled, isAr: isAr, loading: loading, error: t(error || ''), onBackClicked: function () { return onBack(); } }, { children: t('confirm') }))] })) })) }));
71
75
  };
72
76
  export default React.memo(OTP);
@@ -16,8 +16,9 @@ import { useTranslation } from 'react-i18next';
16
16
  import Box from '@mui/material/Box/Box';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
+ import { authSelector, clearError, resendOTP } from '../../../app/auth/authStore';
19
20
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { useAppDispatch } from '../../../../hooks';
21
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
21
22
  var BoxStyled = styled(Box)(function (_a) {
22
23
  var theme = _a.theme;
23
24
  return ({
@@ -31,14 +32,20 @@ var OTPInput = function (_a) {
31
32
  var t = useTranslation().t;
32
33
  var dispatch = useAppDispatch();
33
34
  var otpControl = useController({ name: 'otp', control: control });
35
+ var _c = useAppSelector(authSelector), error = _c.error, loading = _c.loading;
34
36
  var handleOnOTPChange = function (otp) {
37
+ if (!!error)
38
+ dispatch(clearError());
35
39
  otpControl.field.onChange(otp);
36
40
  };
37
41
  var handleOnResendOTP = function () {
42
+ if (!!error)
43
+ dispatch(clearError());
38
44
  if (otpControl.field.value)
39
45
  setValue('otp', '', { shouldValidate: true });
46
+ dispatch(resendOTP());
40
47
  };
41
48
  var otpValue = otpControl.field.value;
42
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
49
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: loading ? undefined : handleOnResendOTP, value: otpValue, disabled: loading, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
43
50
  };
44
51
  export default React.memo(OTPInput);