@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
@@ -49,13 +49,13 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
52
+ import { handleNextScreenStep } from '../../../app/settings';
53
53
  import { BUSINESS_FLOW_SUCCESS, INDIVIDUAl_STEP_NAMES } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var payload, settings, data, boardData, countryCode, boardInfoData, countries, board_id, board_info_id, entity, info, hasIndividualCompleted;
56
- var _a, _b, _c;
57
- return __generator(this, function (_d) {
58
- switch (_d.label) {
55
+ var payload, settings, data, boardData, individualData, countryCode, boardInfoData, countries, board_id, board_info_id, notification, _a, id, type, info, hasIndividualCompleted;
56
+ var _b, _c, _d, _e;
57
+ return __generator(this, function (_f) {
58
+ switch (_f.label) {
59
59
  case 0:
60
60
  payload = {
61
61
  service_name: 'tap_email',
@@ -64,49 +64,59 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
64
64
  settings = thunkApi.getState().settings;
65
65
  return [4, API.leadService.verifyLeadToken(payload)];
66
66
  case 1:
67
- data = (_d.sent()).data;
67
+ data = (_f.sent()).data;
68
68
  boardInfoData = undefined;
69
69
  countries = settings.data.countries;
70
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 6];
70
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
71
+ if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 10];
71
72
  board_id = data === null || data === void 0 ? void 0 : data.id;
72
73
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
73
- if (!(!!board_id && !!board_info_id)) return [3, 3];
74
+ if (!(board_id && board_info_id)) return [3, 4];
74
75
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
75
76
  case 2:
76
- boardInfoData = _d.sent();
77
- _d.label = 3;
78
- case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
77
+ boardInfoData = _f.sent();
78
+ notification = (boardInfoData || {}).notification;
79
+ _a = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _a.id, type = _a.type;
80
+ if (!(id && type)) return [3, 4];
81
+ return [4, API.individualService.retrieveIndividual(id, type)];
82
+ case 3:
83
+ individualData = _f.sent();
84
+ _f.label = 4;
79
85
  case 4:
80
- boardData = _d.sent();
81
- entity = ((boardData === null || boardData === void 0 ? void 0 : boardData.business) || {}).entity;
82
- countryCode = entity === null || entity === void 0 ? void 0 : entity.country;
86
+ countryCode = (_b = individualData === null || individualData === void 0 ? void 0 : individualData.user) === null || _b === void 0 ? void 0 : _b.nationality;
83
87
  info = boardInfoData.info;
84
- hasIndividualCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
85
- return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
88
+ hasIndividualCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
89
+ if (!hasIndividualCompleted) return [3, 7];
90
+ if (!board_id) return [3, 6];
91
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
86
92
  case 5:
87
- _d.sent();
88
- if (data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_AUTH) {
89
- thunkApi.dispatch(handleCurrentActiveScreen('INDIVIDUAL_VERIFY_STEP'));
90
- }
91
- else if (hasIndividualCompleted) {
92
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
93
- }
94
- else if (data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO) {
95
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
96
- }
97
- _d.label = 6;
98
- case 6: return [2, {
93
+ boardData = _f.sent();
94
+ _f.label = 6;
95
+ case 6:
96
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
97
+ return [3, 10];
98
+ case 7:
99
+ if (!countryCode) return [3, 9];
100
+ return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
101
+ case 8:
102
+ _f.sent();
103
+ _f.label = 9;
104
+ case 9:
105
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
106
+ _f.label = 10;
107
+ case 10: return [2, {
99
108
  data: data,
100
109
  boardResponse: {
101
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
110
+ user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
102
111
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
103
112
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
104
113
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
105
114
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
106
- name: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _b === void 0 ? void 0 : _b.name,
107
- contact: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.contact,
115
+ name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
116
+ contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
108
117
  countries: countries,
109
118
  countryCode: countryCode,
119
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
110
120
  flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
111
121
  },
112
122
  token: token
@@ -132,16 +142,24 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
132
142
  });
133
143
  }); });
134
144
  export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
135
- var _a, sourceIncome, monthlyIncome, occupation;
145
+ var monthlyIncomeBody, dataBody, _a, sourceIncome, monthlyIncome, occupation;
136
146
  return __generator(this, function (_b) {
137
147
  switch (_b.label) {
138
- case 0: return [4, Promise.all([
139
- API.dataService.getSourceOfIncome(),
140
- API.dataService.getMonthlyIncome(countryCode),
141
- API.dataService.getOccupation()
142
- ])];
148
+ case 0:
149
+ monthlyIncomeBody = {
150
+ page: 0,
151
+ country_code: [countryCode]
152
+ };
153
+ dataBody = {
154
+ page: 0
155
+ };
156
+ return [4, Promise.all([
157
+ API.dataService.getSourceOfIncome(dataBody),
158
+ API.dataService.getMonthlyIncome(monthlyIncomeBody),
159
+ API.dataService.getOccupation(dataBody)
160
+ ])];
143
161
  case 1:
144
- _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data, occupation = _a[2];
162
+ _a = _b.sent(), sourceIncome = _a[0], monthlyIncome = _a[1], occupation = _a[2];
145
163
  return [2, {
146
164
  sourceIncome: sourceIncome,
147
165
  monthlyIncome: monthlyIncome,
@@ -159,70 +177,113 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
159
177
  case 1:
160
178
  data = _c.sent();
161
179
  return [2, {
162
- data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
180
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
163
181
  }];
164
182
  }
165
183
  });
166
184
  }); });
167
185
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
168
- var _a, individual, settings, responseBody, payload, data, flows, hasIndividualCompleted;
169
- var _b, _c, _d, _e;
170
- return __generator(this, function (_f) {
171
- switch (_f.label) {
186
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, notification, _c, id, type, info, hasIndividualCompleted;
187
+ var _d, _e, _f, _g, _h, _j, _k;
188
+ return __generator(this, function (_l) {
189
+ switch (_l.label) {
172
190
  case 0:
173
191
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
174
192
  responseBody = individual.data.verify.responseBody;
193
+ _b = responseBody || {}, board_id = _b.board_id, board_info_id = _b.board_info_id;
194
+ countries = settings.data.countries;
175
195
  payload = {
176
196
  data: params.otp,
177
- service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
197
+ service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
178
198
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
179
199
  step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
180
200
  encryption_contract: ['data']
181
201
  };
182
202
  return [4, API.leadService.verifyLeadOTP(payload)];
183
203
  case 1:
184
- data = (_f.sent()).data;
185
- if (!(data === null || data === void 0 ? void 0 : data.errors)) {
186
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
187
- flows = (responseBody || {}).flows;
188
- hasIndividualCompleted = ((_e = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'individual'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
189
- if (hasIndividualCompleted) {
190
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
191
- }
192
- else {
193
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
194
- }
195
- }
196
- return [2, { data: data, formData: __assign({}, params) }];
204
+ data = (_l.sent()).data;
205
+ countryCode = undefined;
206
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 10];
207
+ if (!(board_id && board_info_id)) return [3, 4];
208
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
209
+ case 2:
210
+ boardInfoData = _l.sent();
211
+ notification = (boardInfoData || {}).notification;
212
+ _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
213
+ if (!(id && type)) return [3, 4];
214
+ return [4, API.individualService.retrieveIndividual(id, type)];
215
+ case 3:
216
+ individualData = _l.sent();
217
+ _l.label = 4;
218
+ case 4:
219
+ countryCode = (_e = individualData === null || individualData === void 0 ? void 0 : individualData.user) === null || _e === void 0 ? void 0 : _e.nationality;
220
+ info = boardInfoData.info;
221
+ hasIndividualCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
222
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
223
+ if (!hasIndividualCompleted) return [3, 7];
224
+ if (!board_id) return [3, 6];
225
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
226
+ case 5:
227
+ boardData = _l.sent();
228
+ _l.label = 6;
229
+ case 6:
230
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
231
+ return [3, 10];
232
+ case 7:
233
+ if (!countryCode) return [3, 9];
234
+ return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
235
+ case 8:
236
+ _l.sent();
237
+ _l.label = 9;
238
+ case 9:
239
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
240
+ _l.label = 10;
241
+ case 10: return [2, {
242
+ data: data,
243
+ boardResponse: {
244
+ user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
245
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
246
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
247
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
248
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
249
+ name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
250
+ contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
251
+ countries: countries,
252
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
253
+ flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
254
+ },
255
+ formData: __assign({}, params)
256
+ }];
197
257
  }
198
258
  });
199
259
  }); });
200
260
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
201
- var _a, settings, individual, requestBody, data;
202
- var _b, _c, _d, _e, _f, _g, _h, _j;
203
- return __generator(this, function (_k) {
204
- switch (_k.label) {
261
+ var _a, settings, individual, _b, id, type, requestBody, data;
262
+ var _c, _d, _e, _f, _g, _h, _j, _k;
263
+ return __generator(this, function (_l) {
264
+ switch (_l.label) {
205
265
  case 0:
206
266
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
267
+ _b = ((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id = _b.id, type = _b.type;
207
268
  requestBody = {
208
- id: (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.individual_id,
209
- lead_id: (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.id,
210
- occupation: (_d = params.occupation) === null || _d === void 0 ? void 0 : _d.id,
269
+ id: id,
270
+ type: type,
271
+ occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
211
272
  employer_name: params.employerName,
212
- employer_country: (_e = params.employerLocation) === null || _e === void 0 ? void 0 : _e.iso2,
213
- source_income: [(_f = params.sourceIncome) === null || _f === void 0 ? void 0 : _f.id],
214
- actual_income: (_g = params.monthlyIncome) === null || _g === void 0 ? void 0 : _g.id,
273
+ employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
274
+ source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
275
+ monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
215
276
  is_relative_PEP: params.isPEP,
216
277
  is_influencer: params.isInfluencer,
217
- encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'source_income[0]'],
278
+ encryption_contract: ['employer_name', 'employer_country'],
218
279
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
219
280
  };
220
- return [4, API.entityService.updateIndividualInfo(requestBody)];
281
+ return [4, API.individualService.updateIndividual(requestBody)];
221
282
  case 1:
222
- data = (_k.sent()).data;
283
+ data = (_l.sent()).data;
223
284
  if (!(data === null || data === void 0 ? void 0 : data.errors)) {
224
285
  thunkApi.dispatch(handleNextScreenStep());
225
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
286
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
226
287
  }
227
288
  return [2, { data: data, formData: params }];
228
289
  }
@@ -308,23 +369,25 @@ export var individualSlice = createSlice({
308
369
  state.error = description;
309
370
  return;
310
371
  }
311
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
372
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
312
373
  state.data.verify.token = token;
313
- var _c = boardResponse || {}, countries = _c.countries, countryCode = _c.countryCode, brand = _c.brand;
314
- var _d = brand || {}, source_income = _d.source_income, actual_income = _d.actual_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
374
+ var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
375
+ var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
315
376
  var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
316
- var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a, _b; return ((_a = source === null || source === void 0 ? void 0 : source.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
377
+ var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
378
+ (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
317
379
  if (!!selectedSourceIncome)
318
380
  state.data.individualData.sourceIncome = selectedSourceIncome;
319
- var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { var _a; return ((_a = income === null || income === void 0 ? void 0 : income.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === (actual_income === null || actual_income === void 0 ? void 0 : actual_income.toLocaleLowerCase()); })) || (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
381
+ var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
382
+ (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
320
383
  if (!!selectedMonthlyIncome)
321
384
  state.data.individualData.monthlyIncome = selectedMonthlyIncome;
322
- var code = (data === null || data === void 0 ? void 0 : data.employer_country) || countryCode;
385
+ var code = user === null || user === void 0 ? void 0 : user.employer_country;
323
386
  if (!!code) {
324
387
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
325
388
  state.data.individualData.employerLocation = employerLocation;
326
389
  }
327
- var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { var _a; return ((_a = o === null || o === void 0 ? void 0 : o.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === (occupation === null || occupation === void 0 ? void 0 : occupation.toLocaleLowerCase()); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
390
+ var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
328
391
  if (!!selectedOccupation)
329
392
  state.data.individualData.occupation = selectedOccupation;
330
393
  state.data.individualData.isPEP = is_relative_PEP;
@@ -359,7 +422,7 @@ export var individualSlice = createSlice({
359
422
  var _a;
360
423
  state.loading = false;
361
424
  state.error = null;
362
- var _b = action.payload, data = _b.data, formData = _b.formData;
425
+ var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse;
363
426
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
364
427
  if (description) {
365
428
  state.error = description;
@@ -367,7 +430,28 @@ export var individualSlice = createSlice({
367
430
  }
368
431
  state.data.otpData = formData;
369
432
  state.data.otpData.responseBody = data;
370
- state.data.individualData = __assign({}, state.data.individualData);
433
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
434
+ var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
435
+ var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
436
+ var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
437
+ var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
438
+ (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
439
+ if (!!selectedSourceIncome)
440
+ state.data.individualData.sourceIncome = selectedSourceIncome;
441
+ var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
442
+ (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
443
+ if (!!selectedMonthlyIncome)
444
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
445
+ var code = user === null || user === void 0 ? void 0 : user.employer_country;
446
+ if (!!code) {
447
+ var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
448
+ state.data.individualData.employerLocation = employerLocation;
449
+ }
450
+ var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
451
+ if (!!selectedOccupation)
452
+ state.data.individualData.occupation = selectedOccupation;
453
+ state.data.individualData.isPEP = is_relative_PEP;
454
+ state.data.individualData.isInfluencer = is_influencer;
371
455
  })
372
456
  .addCase(verifyLeadOTP.rejected, function (state, action) {
373
457
  state.loading = false;
@@ -382,7 +466,7 @@ export var individualSlice = createSlice({
382
466
  state.error = null;
383
467
  var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, occupation = _a.occupation;
384
468
  var data = state.data.individualData.responseBody;
385
- state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [], occupationList: occupation || [] });
469
+ state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.list) || [], monthlyIncomeList: (monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.list) || [], occupationList: (occupation === null || occupation === void 0 ? void 0 : occupation.list) || [] });
386
470
  })
387
471
  .addCase(retrieveDataList.rejected, function (state, action) {
388
472
  state.loading = false;
@@ -417,8 +501,8 @@ export var individualSlice = createSlice({
417
501
  state.error = null;
418
502
  state.loading = false;
419
503
  var data = (action.payload || {}).data;
420
- var _a = data || {}, entity = _a.entity, user = _a.user;
421
- state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { entity: entity, name: user === null || user === void 0 ? void 0 : user.name });
504
+ var entity = (data || {}).entity;
505
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { entity: entity });
422
506
  })
423
507
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
424
508
  state.error = action.error.message;
@@ -118,7 +118,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails
118
118
  case 1:
119
119
  data = _c.sent();
120
120
  return [2, {
121
- data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
121
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
122
122
  }];
123
123
  }
124
124
  });
@@ -257,8 +257,9 @@ export var taxSlice = createSlice({
257
257
  state.error = description;
258
258
  return;
259
259
  }
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 });
260
+ 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
261
  state.data.verify.token = token;
262
+ state.data.taxData.vatId = vatID;
262
263
  })
263
264
  .addCase(verifyLeadToken.pending, function (state) {
264
265
  state.error = null;
@@ -358,7 +359,7 @@ export var taxSlice = createSlice({
358
359
  return;
359
360
  }
360
361
  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 });
362
+ 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
363
  })
363
364
  .addCase(updateLeadSuccess.pending, function (state) {
364
365
  state.loading = true;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { LibConfig } from '../../@types';
3
+ export interface AuthLibProps extends LibConfig {
4
+ postURL: string;
5
+ leadId: string;
6
+ onClose?: () => void;
7
+ }
8
+ export declare function AuthLib(props: AuthLibProps): JSX.Element;
9
+ export declare function renderAuthLib(config: AuthLibProps, elementId: string): void;
10
+ export declare function unmountAuthLib(elementId: string, unmountTimeout?: number): void;
@@ -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
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
24
+ import { memo, useEffect } from 'react';
25
+ import { FeatureContainer } from '../shared/Containers';
26
+ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
27
+ import { settingsSelector, handleOpen } from '../../app/settings';
28
+ import AnimationFlow from '../../components/AnimationFlow';
29
+ import { store } from '../../app/store';
30
+ import { authSelector, retrieveLead, storeLeadId, storePostUrl } from '../app/auth/authStore';
31
+ import { ReduxProvider, ThemeProvider } from '../../components/Providers';
32
+ import Collapse from '../../components/Collapse';
33
+ import { reactElement, removeElement } from '../../utils';
34
+ import { AUTH_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
35
+ import { authFeatureScreens } from '../featuresScreens';
36
+ import Background from '../shared/Background';
37
+ var Auth = memo(function (_a) {
38
+ var onClose = _a.onClose, props = __rest(_a, ["onClose"]);
39
+ var theme = useAppTheme().theme;
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));
44
+ useErrorListener(authError || error);
45
+ useStepStartedListener();
46
+ var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
47
+ useEffect(function () {
48
+ if (!props.leadId)
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 }));
58
+ }, []);
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) {
67
+ var Element = _a.element, name = _a.name;
68
+ var isActive = activeScreen.name === name;
69
+ return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
70
+ }) }) })) })) })));
71
+ });
72
+ export function AuthLib(props) {
73
+ return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Auth, __assign({}, props)) })));
74
+ }
75
+ export function renderAuthLib(config, elementId) {
76
+ reactElement(elementId).render(_jsx(AuthLib, __assign({}, config)));
77
+ }
78
+ export function unmountAuthLib(elementId, unmountTimeout) {
79
+ if (unmountTimeout === void 0) { unmountTimeout = 1000; }
80
+ var element = document.getElementById(elementId);
81
+ setTimeout(function () {
82
+ var _a;
83
+ ((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
84
+ removeElement(DIALOG_ID);
85
+ elementId && reactElement(elementId).unmount();
86
+ }, unmountTimeout);
87
+ }
@@ -0,0 +1 @@
1
+ export * from './Auth';
@@ -0,0 +1 @@
1
+ export * from './Auth';
@@ -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;