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

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 (280) hide show
  1. package/build/@types/app.d.ts +57 -20
  2. package/build/@types/app.js +14 -1
  3. package/build/@types/form.d.ts +17 -10
  4. package/build/api/auth.d.ts +24 -2
  5. package/build/api/auth.js +36 -1
  6. package/build/api/axios.js +2 -2
  7. package/build/api/brand.d.ts +2 -1
  8. package/build/api/brand.js +10 -1
  9. package/build/api/country.d.ts +3 -1
  10. package/build/api/country.js +3 -1
  11. package/build/api/data.d.ts +38 -7
  12. package/build/api/data.js +57 -17
  13. package/build/api/entity.d.ts +28 -5
  14. package/build/api/entity.js +23 -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 +41 -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 +8 -6
  21. package/build/app/rootReducer.d.ts +1 -1
  22. package/build/app/rootReducer.js +2 -2
  23. package/build/app/settings.d.ts +8 -2
  24. package/build/app/settings.js +29 -12
  25. package/build/app/store.d.ts +3 -3
  26. package/build/assets/locales/ar.json +256 -179
  27. package/build/assets/locales/en.json +188 -104
  28. package/build/components/AnimationFlow/AnimationFlow.d.ts +5 -1
  29. package/build/components/AnimationFlow/AnimationFlow.js +6 -8
  30. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  31. package/build/components/AnimationFlow/BottomSheet.js +4 -3
  32. package/build/components/AnimationFlow/Dialog.d.ts +5 -1
  33. package/build/components/AnimationFlow/Dialog.js +11 -5
  34. package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
  35. package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
  36. package/build/components/ArabicDatePicker/index.d.ts +2 -0
  37. package/build/components/ArabicDatePicker/index.js +2 -0
  38. package/build/components/ArabicDatePicker/style.css +24 -0
  39. package/build/components/FileInput/DragAndDrop.d.ts +10 -1
  40. package/build/components/FileInput/DragAndDrop.js +107 -8
  41. package/build/components/Lottie/Lottie.d.ts +878 -0
  42. package/build/components/Lottie/Lottie.js +58 -0
  43. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  44. package/build/components/Lottie/files/success.json +425 -0
  45. package/build/components/Lottie/index.d.ts +3 -0
  46. package/build/components/Lottie/index.js +3 -0
  47. package/build/components/OTPField/OTPField.d.ts +2 -1
  48. package/build/components/OTPField/OTPField.js +2 -2
  49. package/build/components/OTPTimer/OTPTimer.js +1 -1
  50. package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
  51. package/build/components/ProgressBar/CircularProgressBar.js +48 -0
  52. package/build/components/ProgressBar/index.d.ts +2 -0
  53. package/build/components/ProgressBar/index.js +2 -0
  54. package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
  55. package/build/components/RadioLabel/RadioLabel.js +2 -2
  56. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +1 -4
  57. package/build/components/SocialMediaGroup/SocialMediaGroup.js +3 -55
  58. package/build/constants/api.d.ts +6 -0
  59. package/build/constants/api.js +14 -1
  60. package/build/constants/app.d.ts +7 -5
  61. package/build/constants/app.js +55 -22
  62. package/build/constants/assets.d.ts +20 -1
  63. package/build/constants/assets.js +27 -8
  64. package/build/constants/dummy.d.ts +1 -1
  65. package/build/constants/dummy.js +2 -2
  66. package/build/constants/validation.d.ts +8 -0
  67. package/build/constants/validation.js +9 -1
  68. package/build/features/app/auth/authStore.d.ts +47 -0
  69. package/build/features/app/auth/authStore.js +265 -0
  70. package/build/features/app/bank/bankStore.d.ts +16 -0
  71. package/build/features/app/bank/bankStore.js +81 -37
  72. package/build/features/app/business/businessStore.d.ts +22 -3
  73. package/build/features/app/business/businessStore.js +430 -290
  74. package/build/features/app/connect/connectStore.d.ts +33 -30
  75. package/build/features/app/connect/connectStore.js +398 -258
  76. package/build/features/app/entity/entityStore.d.ts +5 -0
  77. package/build/features/app/entity/entityStore.js +153 -14
  78. package/build/features/app/individual/individualStore.d.ts +17 -0
  79. package/build/features/app/individual/individualStore.js +167 -83
  80. package/build/features/app/password/passwordStore.js +1 -1
  81. package/build/features/app/tax/taxStore.js +3 -2
  82. package/build/features/auth/Auth.d.ts +10 -0
  83. package/build/features/auth/Auth.js +87 -0
  84. package/build/features/auth/index.d.ts +1 -0
  85. package/build/features/auth/index.js +1 -0
  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 +67 -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.d.ts +5 -0
  99. package/build/features/auth/screens/OTP/OTP.js +76 -0
  100. package/build/features/{otp/screens/OTPVerify/Verify.d.ts → auth/screens/OTP/OTPInput.d.ts} +0 -0
  101. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/OTPInput.js +11 -7
  102. package/build/features/auth/screens/OTP/index.d.ts +3 -0
  103. package/build/features/auth/screens/OTP/index.js +2 -0
  104. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.d.ts +0 -0
  105. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.js +0 -0
  106. package/build/features/bank/Bank.js +12 -6
  107. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
  108. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  109. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  110. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  111. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  112. package/build/features/business/Business.d.ts +1 -1
  113. package/build/features/business/Business.js +14 -7
  114. package/build/features/business/screens/Activities/Activities.js +1 -6
  115. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  116. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  117. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  118. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  119. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  120. package/build/features/business/screens/Activities/validation.js +0 -9
  121. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  122. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  123. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  124. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  125. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  126. package/build/features/business/screens/BusinessType/LicenseList.js +24 -7
  127. package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
  128. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  129. package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
  130. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  131. package/build/features/business/screens/BusinessType/validation.js +50 -1
  132. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  133. package/build/features/business/screens/CivilID/CivilID.js +84 -0
  134. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  135. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  136. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  137. package/build/features/business/screens/CivilID/index.js +2 -0
  138. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  139. package/build/features/business/screens/CivilID/validation.js +4 -0
  140. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  141. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  142. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  143. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  144. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  145. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  146. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -7
  147. package/build/features/business/screens/Verify/Verify.js +4 -4
  148. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  149. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +157 -0
  150. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
  151. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +22 -0
  152. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  153. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  154. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  155. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  156. package/build/features/connect/Connect.d.ts +2 -1
  157. package/build/features/connect/Connect.js +47 -12
  158. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  159. package/build/features/connect/screens/CivilID/CivilID.js +98 -0
  160. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  161. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  162. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  163. package/build/features/connect/screens/CivilID/index.js +2 -0
  164. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  165. package/build/features/connect/screens/CivilID/validation.js +4 -0
  166. package/build/features/connect/screens/Individual/Email.js +11 -3
  167. package/build/features/connect/screens/Individual/Individual.js +27 -14
  168. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  169. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  170. package/build/features/connect/screens/Merchant/Merchant.js +47 -50
  171. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +7 -0
  172. package/build/features/connect/screens/Merchant/SalesChannels.js +113 -0
  173. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  174. package/build/features/connect/screens/Merchant/SocialMedia.js +131 -66
  175. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  176. package/build/features/connect/screens/Merchant/validation.d.ts +22 -45
  177. package/build/features/connect/screens/Merchant/validation.js +117 -116
  178. package/build/features/connect/screens/Mobile/Mobile.js +31 -10
  179. package/build/features/connect/screens/NID/NID.js +2 -1
  180. package/build/features/connect/screens/OTP/OTP.js +5 -4
  181. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  182. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  183. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  184. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
  185. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +22 -0
  186. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  187. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  188. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  189. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  190. package/build/features/entity/Entity.d.ts +1 -1
  191. package/build/features/entity/Entity.js +16 -9
  192. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
  193. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +140 -0
  194. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +52 -2
  195. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
  196. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
  197. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
  198. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
  199. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
  200. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
  201. package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.d.ts +0 -0
  202. package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.js +8 -5
  203. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
  204. package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
  205. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
  206. package/build/features/featuresScreens.d.ts +1 -1
  207. package/build/features/featuresScreens.js +31 -6
  208. package/build/features/individual/Individual.d.ts +1 -1
  209. package/build/features/individual/Individual.js +14 -7
  210. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
  211. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  212. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  213. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  214. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  215. package/build/features/individual/screens/Verify/Verify.js +4 -4
  216. package/build/features/password/Password.d.ts +1 -1
  217. package/build/features/password/Password.js +14 -7
  218. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -9
  219. package/build/features/shared/Background/Background.d.ts +6 -5
  220. package/build/features/shared/Background/Background.js +16 -5
  221. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  222. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  223. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  224. package/build/features/shared/Button/MobileButton.js +2 -2
  225. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  226. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  227. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  228. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  229. package/build/features/shared/Dialog/index.d.ts +4 -0
  230. package/build/features/shared/Dialog/index.js +4 -0
  231. package/build/features/shared/Input/Input.d.ts +1 -1
  232. package/build/features/shared/Input/Input.js +2 -2
  233. package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
  234. package/build/features/shared/UploadFile/UploadFile.d.ts +9 -3
  235. package/build/features/shared/UploadFile/UploadFile.js +23 -8
  236. package/build/features/signIn/SignIn.d.ts +1 -1
  237. package/build/features/signIn/SignIn.js +14 -6
  238. package/build/features/tax/Tax.d.ts +1 -1
  239. package/build/features/tax/Tax.js +16 -8
  240. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -7
  241. package/build/hooks/index.d.ts +1 -0
  242. package/build/hooks/index.js +1 -0
  243. package/build/hooks/useAppConfig.d.ts +3 -1
  244. package/build/hooks/useAppConfig.js +4 -2
  245. package/build/hooks/useAppDispatch.d.ts +1 -1
  246. package/build/hooks/useErrorListener.js +0 -5
  247. package/build/hooks/useScreen.d.ts +3 -0
  248. package/build/hooks/useScreen.js +14 -0
  249. package/build/index.d.ts +3 -3
  250. package/build/index.js +5 -5
  251. package/build/utils/array.d.ts +13 -1
  252. package/build/utils/array.js +26 -0
  253. package/build/utils/common.d.ts +1 -0
  254. package/build/utils/common.js +3 -0
  255. package/build/utils/device.d.ts +1 -0
  256. package/build/utils/device.js +13 -0
  257. package/build/utils/html.d.ts +1 -0
  258. package/build/utils/html.js +6 -0
  259. package/build/utils/index.d.ts +1 -0
  260. package/build/utils/index.js +1 -0
  261. package/build/utils/locale.js +1 -1
  262. package/build/utils/object.d.ts +1 -0
  263. package/build/utils/object.js +12 -0
  264. package/build/utils/rsa.d.ts +2 -2
  265. package/build/utils/rsa.js +1 -1
  266. package/build/utils/string.d.ts +33 -20
  267. package/build/utils/string.js +71 -1
  268. package/build/utils/validation.d.ts +2 -0
  269. package/build/utils/validation.js +6 -0
  270. package/package.json +129 -128
  271. package/build/features/app/otp/otpStore.d.ts +0 -28
  272. package/build/features/app/otp/otpStore.js +0 -153
  273. package/build/features/otp/OTP.d.ts +0 -7
  274. package/build/features/otp/OTP.js +0 -55
  275. package/build/features/otp/index.d.ts +0 -0
  276. package/build/features/otp/index.js +0 -1
  277. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  278. package/build/features/otp/screens/OTPVerify/Verify.js +0 -50
  279. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  280. package/build/features/otp/screens/OTPVerify/index.js +0 -2
@@ -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,67 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * 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 } 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 defaultDob = responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth;
42
+ var methods = useForm({
43
+ resolver: yupResolver(!defaultDob ? NIDDOBValidationSchema : NIDValidationSchema),
44
+ defaultValues: {
45
+ nid: nid,
46
+ dob: dob,
47
+ termAndConditionChecked: termAndConditionChecked
48
+ },
49
+ mode: 'onChange'
50
+ });
51
+ React.useEffect(function () {
52
+ handleClearError();
53
+ }, [methods.formState.isValid]);
54
+ var onSubmit = function (data) {
55
+ dispatch(createAuth(data));
56
+ };
57
+ var handleCollapseOpenClose = function (flag) {
58
+ setCollapse(flag);
59
+ };
60
+ var handleClearError = function () {
61
+ if (error)
62
+ dispatch(clearError());
63
+ };
64
+ var disabled = !methods.formState.isValid || !!error;
65
+ 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: !defaultDob, 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') }))] }))] })) })) }));
66
+ };
67
+ 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
+ });
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface OTPProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,76 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import Box from '@mui/material/Box/Box';
14
+ import { styled } from '@mui/material/styles';
15
+ import * as React from 'react';
16
+ import { useTranslation } from 'react-i18next';
17
+ import Text from '../../../../components/Text';
18
+ import { clearError, authSelector, resetOTPScreen, verifyAuthOTP } from '../../../app/auth/authStore';
19
+ import Button from '../../../shared/Button';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
+ import { useLanguage } from '../../../../hooks';
23
+ import { useForm, FormProvider } from 'react-hook-form';
24
+ import { yupResolver } from '@hookform/resolvers/yup';
25
+ import { handlePrevScreenStep } from '../../../../app/settings';
26
+ import Form from '../../../../components/Form';
27
+ import { maskPhone } from '../../../../utils';
28
+ import { OTPValidation } from './validation';
29
+ import OTPInput from './OTPInput';
30
+ var OTPTitleContainerStyled = styled(Box)(function (_a) {
31
+ var theme = _a.theme;
32
+ return ({
33
+ background: theme.palette.common.white,
34
+ border: '1px solid',
35
+ borderColor: theme.palette.divider,
36
+ direction: theme.direction,
37
+ borderRadius: theme.spacing(0, 0, 1.25, 1.25),
38
+ marginBottom: theme.spacing(5.75)
39
+ });
40
+ });
41
+ var OTPTitleStyled = styled(Text)(function (_a) {
42
+ var theme = _a.theme;
43
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
44
+ });
45
+ var FormStyled = styled(Form)(function () { return ({
46
+ display: 'flex',
47
+ flexDirection: 'column'
48
+ }); });
49
+ var OTP = function () {
50
+ var dispatch = useAppDispatch();
51
+ var _a = useAppSelector(authSelector), data = _a.data, loading = _a.loading, error = _a.error;
52
+ var methods = useForm({
53
+ resolver: yupResolver(OTPValidation),
54
+ defaultValues: { otp: '' },
55
+ mode: 'onChange'
56
+ });
57
+ var t = useTranslation().t;
58
+ var isAr = useLanguage().isAr;
59
+ React.useEffect(function () {
60
+ if (error)
61
+ dispatch(clearError());
62
+ return function () {
63
+ dispatch(resetOTPScreen());
64
+ };
65
+ }, [methods.formState.isValid]);
66
+ var onSubmit = function (formData) {
67
+ dispatch(verifyAuthOTP(formData));
68
+ };
69
+ var onBack = function () {
70
+ dispatch(handlePrevScreenStep());
71
+ };
72
+ var disabled = !methods.formState.isValid || !!error;
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') }))] })) })) }));
75
+ };
76
+ export default React.memo(OTP);
@@ -11,14 +11,14 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
+ import { useController, useFormContext } from 'react-hook-form';
15
+ import { useTranslation } from 'react-i18next';
14
16
  import Box from '@mui/material/Box/Box';
15
17
  import { styled } from '@mui/material/styles';
16
18
  import OTPField from '../../../shared/OTP';
17
- import { useController, useFormContext } from 'react-hook-form';
18
- import { useTranslation } from 'react-i18next';
19
+ import { authSelector, clearError, resendOTP } from '../../../app/auth/authStore';
19
20
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { useAppDispatch } from '../../../../hooks';
21
- import { resendOTP } from '../../../app/otp/otpStore';
21
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
22
  var BoxStyled = styled(Box)(function (_a) {
23
23
  var theme = _a.theme;
24
24
  return ({
@@ -28,20 +28,24 @@ var BoxStyled = styled(Box)(function (_a) {
28
28
  });
29
29
  });
30
30
  var OTPInput = function (_a) {
31
- var loading = _a.loading;
32
31
  var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
33
32
  var t = useTranslation().t;
34
- var otpControl = useController({ name: 'otp', control: control });
35
33
  var dispatch = useAppDispatch();
34
+ var otpControl = useController({ name: 'otp', control: control });
35
+ var _c = useAppSelector(authSelector), error = _c.error, loading = _c.loading;
36
36
  var handleOnOTPChange = function (otp) {
37
+ if (!!error)
38
+ dispatch(clearError());
37
39
  otpControl.field.onChange(otp);
38
40
  };
39
41
  var handleOnResendOTP = function () {
42
+ if (!!error)
43
+ dispatch(clearError());
40
44
  if (otpControl.field.value)
41
45
  setValue('otp', '', { shouldValidate: true });
42
46
  dispatch(resendOTP());
43
47
  };
44
48
  var otpValue = otpControl.field.value;
45
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
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()); } }) })));
46
50
  };
47
51
  export default React.memo(OTPInput);
@@ -0,0 +1,3 @@
1
+ import OTP, { OTPProps } from './OTP';
2
+ export type { OTPProps };
3
+ export default OTP;
@@ -0,0 +1,2 @@
1
+ import OTP from './OTP';
2
+ export default OTP;
@@ -17,9 +17,9 @@ import AnimationFlow from '../../components/AnimationFlow';
17
17
  import { store } from '../../app/store';
18
18
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
19
  import Collapse from '../../components/Collapse';
20
- import { getParameterByName, reactElement } from '../../utils';
20
+ import { getParameterByName, reactElement, removeElement } from '../../utils';
21
21
  import { FeatureContainer } from '../shared/Containers';
22
- import { BANK_SCREENS_NAVIGATION } from '../../constants';
22
+ import { BANK_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
23
23
  import { bankFeatureScreens } from '../featuresScreens';
24
24
  import CustomFooter from '../shared/Footer';
25
25
  import { bankSelector, verifyLeadToken } from '../app/bank/bankStore';
@@ -28,7 +28,7 @@ var Bank = memo(function (props) {
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
- var _b = useAppSelector(bankSelector), customLoading = _b.customLoading, bankError = _b.error;
31
+ var _b = useAppSelector(bankSelector), customLoading = _b.customLoading, loading = _b.loading, bankError = _b.error;
32
32
  useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props));
33
33
  useErrorListener(bankError || error);
34
34
  useStepStartedListener();
@@ -43,10 +43,10 @@ var Bank = memo(function (props) {
43
43
  dispatch(verifyLeadToken(token));
44
44
  };
45
45
  useEffect(function () {
46
- if (!settingLoading)
46
+ if (!settingLoading && open)
47
47
  verifyToken();
48
48
  }, [settingLoading]);
49
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
49
+ 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', isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
50
50
  var Element = _a.element, name = _a.name;
51
51
  var isActive = activeScreen.name === name;
52
52
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -59,5 +59,11 @@ export function renderBankLib(config, elementId) {
59
59
  reactElement(elementId).render(_jsx(BankLib, __assign({}, config)));
60
60
  }
61
61
  export function unmountBankLib(elementId) {
62
- reactElement(elementId).unmount();
62
+ var element = document.getElementById(elementId);
63
+ setTimeout(function () {
64
+ var _a;
65
+ ((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
66
+ removeElement(DIALOG_ID);
67
+ elementId && reactElement(elementId).unmount();
68
+ }, 1000);
63
69
  }
@@ -42,7 +42,7 @@ var ButtonStyled = styled(Button)(function (_a) {
42
42
  var BankDetails = function () {
43
43
  var _a = React.useState(false), ibanChecking = _a[0], setIbanChecking = _a[1];
44
44
  var dispatch = useAppDispatch();
45
- var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error;
45
+ var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading;
46
46
  var methods = useForm({
47
47
  resolver: yupResolver(BankValidation),
48
48
  defaultValues: data.bankData,
@@ -56,7 +56,7 @@ var BankDetails = function () {
56
56
  var onBack = function () {
57
57
  dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
58
58
  };
59
- var disabled = ibanChecking || !methods.formState.isValid || !!error;
59
+ var disabled = ibanChecking || !methods.formState.isValid || !!error || uploading;
60
60
  React.useEffect(function () {
61
61
  if (error)
62
62
  dispatch(clearError());
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
2
3
  import { styled } from '@mui/material/styles';
3
4
  import { ScreenContainer } from '../../../shared/Containers';
4
5
  import { useTranslation } from 'react-i18next';
5
6
  import { useController, useFormContext } from 'react-hook-form';
6
- import { useAppSelector } from '../../../../hooks';
7
- import { bankSelector } from '../../../app/bank/bankStore';
7
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
+ import { bankSelector, uploadBankStatement } from '../../../app/bank/bankStore';
8
9
  import UploadFile from '../../../shared/UploadFile';
10
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
9
11
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
10
12
  var theme = _a.theme;
11
13
  return ({
@@ -13,18 +15,49 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
13
15
  });
14
16
  });
15
17
  var BankStatement = function () {
16
- var _a;
18
+ var _a, _b;
19
+ var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
17
20
  var t = useTranslation().t;
18
- var control = useFormContext().control;
21
+ var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors;
19
22
  var bankStatementFileControl = useController({ name: 'bankStatementFile', control: control });
20
- var loading = useAppSelector(bankSelector).loading;
21
- var error = (_a = bankStatementFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
23
+ var bankStatementIdControl = useController({ name: 'bankStatementId', control: control });
24
+ var _e = useAppSelector(bankSelector), loading = _e.loading, uploading = _e.uploading, sysError = _e.error;
25
+ var dispatch = useAppDispatch();
26
+ var bankStatementValue = bankStatementFileControl.field.value;
27
+ var error = ((_a = bankStatementFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = bankStatementIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
22
28
  var handleBankStatementChange = function (file) {
23
- bankStatementFileControl.field.onChange(file);
29
+ if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
30
+ setError('bankStatementFile', { message: 'file_not_supported_alert' });
31
+ }
32
+ else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
33
+ setError('bankStatementFile', { message: 'file_size_alert' });
34
+ }
35
+ else {
36
+ bankStatementFileControl.field.onChange(file);
37
+ dispatch(uploadBankStatement({
38
+ file: file,
39
+ onProgress: function (value) {
40
+ setProgress(value);
41
+ }
42
+ }));
43
+ }
24
44
  };
25
45
  var handleReset = function () {
26
46
  bankStatementFileControl.field.onChange(null);
47
+ bankStatementIdControl.field.onChange('');
48
+ setProgress(0);
27
49
  };
28
- return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), dragTitle: t('drag_and_drop'), uploadTitle: t('title_upload_file'), onFileUploaded: handleBankStatementChange, isSubmitting: loading, onReset: handleReset, error: error && t(error) }) }));
50
+ React.useEffect(function () {
51
+ if (sysError === 'file_upload_error') {
52
+ setError('bankStatementId', { message: sysError });
53
+ bankStatementFileControl.field.onChange(null);
54
+ setProgress(0);
55
+ }
56
+ }, [sysError]);
57
+ React.useEffect(function () {
58
+ if ((bankStatementFileControl.formState.isValid || !!bankStatementValue) && error != 'file_upload_error')
59
+ clearErrors();
60
+ }, [bankStatementFileControl.formState.isValid, bankStatementValue]);
61
+ return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isFileUploaded: !uploading && !!bankStatementValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error) }) }));
29
62
  };
30
63
  export default BankStatement;
@@ -3,11 +3,10 @@ import * as React from 'react';
3
3
  import Input from '../../../shared/Input';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useController, useFormContext } from 'react-hook-form';
6
- import { styled } from '@mui/material';
7
- import { removeOnlyNumbers } from '../../../../utils';
6
+ import { styled } from '@mui/material/styles';
8
7
  import { ScreenContainer } from '../../../shared/Containers';
9
8
  import { bankSelector } from '../../../app/bank/bankStore';
10
- import { useAppSelector, useLanguage } from '../../../../hooks';
9
+ import { useAppSelector } from '../../../../hooks';
11
10
  import ClearIcon from '../../../shared/ClearIcon';
12
11
  import CheckIcon from '../../../shared/CheckIcon';
13
12
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
@@ -25,27 +24,27 @@ var InputStyled = styled(Input)(function (_a) {
25
24
  });
26
25
  });
27
26
  var Beneficiary = function () {
28
- var _a, _b, _c, _d;
27
+ var _a, _b;
29
28
  var t = useTranslation().t;
30
- var _e = useFormContext(), setValue = _e.setValue, control = _e.control;
31
- var isAr = useLanguage().isAr;
29
+ var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
32
30
  var data = useAppSelector(bankSelector).data;
33
31
  var beneficiaryControl = useController({ name: 'beneficiaryName', control: control });
34
32
  var beneficiaryValue = beneficiaryControl.field.value;
35
33
  var hasError = (_a = beneficiaryControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
36
34
  var error = (_b = beneficiaryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
37
- var legalName = (_d = (_c = data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.legal_name;
35
+ var bank_account = (data.verify.responseBody || {}).bank_account;
38
36
  React.useEffect(function () {
39
- setValue('beneficiaryName', isAr ? legalName === null || legalName === void 0 ? void 0 : legalName.ar : legalName === null || legalName === void 0 ? void 0 : legalName.en);
37
+ var beneficiary_name = (bank_account || {}).beneficiary_name;
38
+ if (beneficiary_name)
39
+ setValue('beneficiaryName', beneficiary_name);
40
40
  }, []);
41
41
  var handleBeneficiaryChange = function (_a) {
42
42
  var target = _a.target;
43
- var value = removeOnlyNumbers(target.value);
44
- beneficiaryControl.field.onChange(value);
43
+ beneficiaryControl.field.onChange(target.value);
45
44
  };
46
45
  var clearValue = function () {
47
46
  beneficiaryControl.field.onChange('');
48
47
  };
49
- return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('beneficiary_name'), onChange: handleBeneficiaryChange, disabled: !!legalName, value: beneficiaryValue, placeholder: t('beneficiary_name'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !hasError && beneficiaryValue ? _jsx(CheckIcon, {}) : beneficiaryValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
48
+ return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('beneficiary_name'), onChange: handleBeneficiaryChange, value: beneficiaryValue, placeholder: t('beneficiary_name'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !hasError && beneficiaryValue ? _jsx(CheckIcon, {}) : beneficiaryValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
50
49
  };
51
50
  export default Beneficiary;