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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/build/@types/app.d.ts +52 -21
  2. package/build/@types/app.js +10 -3
  3. package/build/@types/form.d.ts +18 -10
  4. package/build/api/auth.d.ts +24 -2
  5. package/build/api/auth.js +36 -1
  6. package/build/api/axios.js +2 -2
  7. package/build/api/brand.d.ts +2 -1
  8. package/build/api/brand.js +10 -1
  9. package/build/api/country.d.ts +3 -1
  10. package/build/api/country.js +3 -1
  11. package/build/api/data.d.ts +38 -7
  12. package/build/api/data.js +57 -17
  13. package/build/api/entity.d.ts +53 -5
  14. package/build/api/entity.js +39 -9
  15. package/build/api/firebase.d.ts +1 -1
  16. package/build/api/firebase.js +3 -1
  17. package/build/api/index.d.ts +44 -14
  18. package/build/api/individual.d.ts +76 -19
  19. package/build/api/individual.js +29 -2
  20. package/build/api/lead.d.ts +9 -6
  21. package/build/api/lead.js +8 -1
  22. package/build/app/rootReducer.d.ts +1 -1
  23. package/build/app/rootReducer.js +2 -2
  24. package/build/app/settings.d.ts +8 -2
  25. package/build/app/settings.js +29 -12
  26. package/build/app/store.d.ts +3 -3
  27. package/build/assets/locales/ar.json +258 -183
  28. package/build/assets/locales/en.json +190 -108
  29. package/build/components/AnimationFlow/AnimationFlow.d.ts +5 -1
  30. package/build/components/AnimationFlow/AnimationFlow.js +6 -8
  31. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  32. package/build/components/AnimationFlow/BottomSheet.js +4 -3
  33. package/build/components/AnimationFlow/Dialog.d.ts +5 -1
  34. package/build/components/AnimationFlow/Dialog.js +11 -5
  35. package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
  36. package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
  37. package/build/components/ArabicDatePicker/index.d.ts +2 -0
  38. package/build/components/ArabicDatePicker/index.js +2 -0
  39. package/build/components/ArabicDatePicker/style.css +24 -0
  40. package/build/components/FileInput/DragAndDrop.d.ts +10 -1
  41. package/build/components/FileInput/DragAndDrop.js +108 -8
  42. package/build/components/Lottie/Lottie.d.ts +878 -0
  43. package/build/components/Lottie/Lottie.js +58 -0
  44. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  45. package/build/components/Lottie/files/success.json +425 -0
  46. package/build/components/Lottie/index.d.ts +3 -0
  47. package/build/components/Lottie/index.js +3 -0
  48. package/build/components/OTPField/OTPField.d.ts +2 -1
  49. package/build/components/OTPField/OTPField.js +2 -2
  50. package/build/components/OTPTimer/OTPTimer.js +1 -1
  51. package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
  52. package/build/components/ProgressBar/CircularProgressBar.js +48 -0
  53. package/build/components/ProgressBar/index.d.ts +2 -0
  54. package/build/components/ProgressBar/index.js +2 -0
  55. package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
  56. package/build/components/RadioLabel/RadioLabel.js +2 -2
  57. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -6
  58. package/build/components/SocialMediaGroup/SocialMediaGroup.js +4 -49
  59. package/build/constants/api.d.ts +6 -0
  60. package/build/constants/api.js +14 -1
  61. package/build/constants/app.d.ts +7 -5
  62. package/build/constants/app.js +56 -23
  63. package/build/constants/assets.d.ts +14 -0
  64. package/build/constants/assets.js +16 -2
  65. package/build/constants/dummy.d.ts +1 -1
  66. package/build/constants/dummy.js +2 -2
  67. package/build/constants/validation.d.ts +8 -0
  68. package/build/constants/validation.js +9 -1
  69. package/build/features/app/auth/authStore.d.ts +47 -0
  70. package/build/features/app/auth/authStore.js +260 -0
  71. package/build/features/app/bank/bankStore.d.ts +16 -0
  72. package/build/features/app/bank/bankStore.js +86 -39
  73. package/build/features/app/business/businessStore.d.ts +22 -3
  74. package/build/features/app/business/businessStore.js +432 -291
  75. package/build/features/app/connect/connectStore.d.ts +33 -31
  76. package/build/features/app/connect/connectStore.js +394 -308
  77. package/build/features/app/entity/entityStore.d.ts +30 -5
  78. package/build/features/app/entity/entityStore.js +258 -47
  79. package/build/features/app/individual/individualStore.d.ts +17 -0
  80. package/build/features/app/individual/individualStore.js +170 -84
  81. package/build/features/app/password/passwordStore.js +1 -1
  82. package/build/features/app/tax/taxStore.js +18 -14
  83. package/build/features/auth/Auth.d.ts +10 -0
  84. package/build/features/auth/Auth.js +87 -0
  85. package/build/features/auth/index.d.ts +1 -0
  86. package/build/features/auth/index.js +1 -0
  87. package/build/features/auth/screens/NID/DOB.d.ts +7 -0
  88. package/build/features/auth/screens/NID/DOB.js +47 -0
  89. package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
  90. package/build/features/auth/screens/NID/IDNumber.js +64 -0
  91. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  92. package/build/features/auth/screens/NID/NID.js +68 -0
  93. package/build/features/auth/screens/NID/TAC.d.ts +3 -0
  94. package/build/features/auth/screens/NID/TAC.js +87 -0
  95. package/build/features/auth/screens/NID/index.d.ts +3 -0
  96. package/build/features/auth/screens/NID/index.js +2 -0
  97. package/build/features/auth/screens/NID/validation.d.ts +27 -0
  98. package/build/features/auth/screens/NID/validation.js +19 -0
  99. package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
  100. package/build/features/auth/screens/OTP/OTP.js +76 -0
  101. package/build/features/{otp/screens/OTPVerify/Verify.d.ts → auth/screens/OTP/OTPInput.d.ts} +0 -0
  102. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/OTPInput.js +11 -7
  103. package/build/features/auth/screens/OTP/index.d.ts +3 -0
  104. package/build/features/auth/screens/OTP/index.js +2 -0
  105. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.d.ts +0 -0
  106. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.js +0 -0
  107. package/build/features/bank/Bank.js +12 -6
  108. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
  109. package/build/features/bank/screens/BankDetails/BankName.js +2 -1
  110. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  111. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  112. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  113. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  114. package/build/features/business/Business.d.ts +1 -1
  115. package/build/features/business/Business.js +14 -7
  116. package/build/features/business/screens/Activities/Activities.js +16 -17
  117. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  118. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  119. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  120. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  121. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  122. package/build/features/business/screens/Activities/validation.js +0 -9
  123. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  124. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  125. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  126. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  127. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  128. package/build/features/business/screens/BusinessType/LicenseList.js +24 -7
  129. package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
  130. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  131. package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
  132. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  133. package/build/features/business/screens/BusinessType/validation.js +50 -1
  134. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  135. package/build/features/business/screens/CivilID/CivilID.js +67 -0
  136. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  137. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  138. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  139. package/build/features/business/screens/CivilID/index.js +2 -0
  140. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  141. package/build/features/business/screens/CivilID/validation.js +4 -0
  142. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  143. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  144. package/build/features/business/screens/Customers/Customers.js +15 -9
  145. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  146. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  147. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  148. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  149. package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
  150. package/build/features/business/screens/OTP/OTP.js +15 -2
  151. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -7
  152. package/build/features/business/screens/Verify/Verify.js +4 -4
  153. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  154. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
  155. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  156. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  157. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  158. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  159. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  160. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  161. package/build/features/connect/Connect.d.ts +2 -1
  162. package/build/features/connect/Connect.js +47 -12
  163. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  164. package/build/features/connect/screens/CivilID/CivilID.js +99 -0
  165. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  166. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  167. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  168. package/build/features/connect/screens/CivilID/index.js +2 -0
  169. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  170. package/build/features/connect/screens/CivilID/validation.js +4 -0
  171. package/build/features/connect/screens/Individual/Email.js +11 -3
  172. package/build/features/connect/screens/Individual/Individual.js +41 -27
  173. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  174. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  175. package/build/features/connect/screens/Merchant/Merchant.js +41 -64
  176. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
  177. package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
  178. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  179. package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
  180. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  181. package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
  182. package/build/features/connect/screens/Merchant/validation.js +108 -173
  183. package/build/features/connect/screens/Mobile/Mobile.js +30 -12
  184. package/build/features/connect/screens/NID/NID.js +2 -1
  185. package/build/features/connect/screens/OTP/OTP.js +20 -6
  186. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  187. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  188. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  189. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  190. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  191. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  192. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  193. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  194. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  195. package/build/features/entity/Entity.d.ts +1 -1
  196. package/build/features/entity/Entity.js +16 -9
  197. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +55 -0
  198. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +149 -0
  199. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
  200. package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
  201. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +71 -2
  202. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
  203. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +32 -0
  204. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
  205. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +49 -0
  206. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
  207. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +33 -0
  208. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +68 -0
  209. package/build/features/entity/screens/EntityInfoConfirm/validation.js +24 -0
  210. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
  211. package/build/features/entity/screens/Verify/Verify.js +18 -5
  212. package/build/features/featuresScreens.d.ts +1 -1
  213. package/build/features/featuresScreens.js +31 -6
  214. package/build/features/individual/Individual.d.ts +1 -1
  215. package/build/features/individual/Individual.js +14 -7
  216. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
  217. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  218. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  219. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  220. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  221. package/build/features/individual/screens/Verify/Verify.js +18 -5
  222. package/build/features/password/Password.d.ts +1 -1
  223. package/build/features/password/Password.js +14 -7
  224. package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
  225. package/build/features/password/screens/OTP/OTP.js +15 -2
  226. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -9
  227. package/build/features/password/screens/Verify/Verify.js +16 -3
  228. package/build/features/shared/Background/Background.d.ts +6 -5
  229. package/build/features/shared/Background/Background.js +16 -5
  230. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  231. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  232. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  233. package/build/features/shared/Button/MobileButton.js +2 -2
  234. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  235. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  236. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  237. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  238. package/build/features/shared/Dialog/index.d.ts +4 -0
  239. package/build/features/shared/Dialog/index.js +4 -0
  240. package/build/features/shared/Input/Input.d.ts +1 -1
  241. package/build/features/shared/Input/Input.js +2 -2
  242. package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
  243. package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
  244. package/build/features/shared/UploadFile/UploadFile.js +24 -9
  245. package/build/features/signIn/SignIn.d.ts +1 -1
  246. package/build/features/signIn/SignIn.js +14 -6
  247. package/build/features/signIn/screens/Email/Email.js +4 -2
  248. package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
  249. package/build/features/signIn/screens/OTP/OTP.js +14 -1
  250. package/build/features/signIn/screens/Password/Password.js +15 -2
  251. package/build/features/tax/Tax.d.ts +1 -1
  252. package/build/features/tax/Tax.js +16 -8
  253. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -7
  254. package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
  255. package/build/features/tax/screens/Verify/Verify.js +16 -3
  256. package/build/hooks/index.d.ts +2 -0
  257. package/build/hooks/index.js +2 -0
  258. package/build/hooks/useAppConfig.d.ts +3 -1
  259. package/build/hooks/useAppConfig.js +4 -2
  260. package/build/hooks/useAppDispatch.d.ts +1 -1
  261. package/build/hooks/useErrorListener.js +0 -6
  262. package/build/hooks/useScreen.d.ts +3 -0
  263. package/build/hooks/useScreen.js +14 -0
  264. package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
  265. package/build/hooks/useSetFromDefaultValues.js +24 -0
  266. package/build/index.d.ts +3 -3
  267. package/build/index.js +5 -5
  268. package/build/utils/array.d.ts +13 -1
  269. package/build/utils/array.js +26 -0
  270. package/build/utils/common.d.ts +1 -0
  271. package/build/utils/common.js +3 -0
  272. package/build/utils/device.d.ts +1 -0
  273. package/build/utils/device.js +13 -0
  274. package/build/utils/html.d.ts +1 -0
  275. package/build/utils/html.js +6 -0
  276. package/build/utils/index.d.ts +1 -0
  277. package/build/utils/index.js +1 -0
  278. package/build/utils/locale.js +1 -1
  279. package/build/utils/object.d.ts +1 -0
  280. package/build/utils/object.js +12 -0
  281. package/build/utils/rsa.d.ts +2 -2
  282. package/build/utils/rsa.js +1 -1
  283. package/build/utils/string.d.ts +33 -20
  284. package/build/utils/string.js +71 -1
  285. package/build/utils/validation.d.ts +2 -0
  286. package/build/utils/validation.js +6 -0
  287. package/package.json +5 -4
  288. package/build/features/app/otp/otpStore.d.ts +0 -28
  289. package/build/features/app/otp/otpStore.js +0 -153
  290. package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
  291. package/build/features/business/screens/Activities/SalesChannels.js +0 -112
  292. package/build/features/otp/OTP.d.ts +0 -7
  293. package/build/features/otp/OTP.js +0 -58
  294. package/build/features/otp/index.d.ts +0 -0
  295. package/build/features/otp/index.js +0 -1
  296. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  297. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  298. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  299. package/build/features/otp/screens/OTPVerify/index.js +0 -2
@@ -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, handleSetCountryByIso2 } 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,61 @@ 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;
83
- 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))];
86
+ if (!board_id) return [3, 6];
87
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
86
88
  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, {
89
+ boardData = _f.sent();
90
+ _f.label = 6;
91
+ case 6:
92
+ countryCode = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
93
+ if (countryCode)
94
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
95
+ info = boardInfoData.info;
96
+ 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';
97
+ if (!hasIndividualCompleted) return [3, 7];
98
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
99
+ return [3, 10];
100
+ case 7:
101
+ if (!countryCode) return [3, 9];
102
+ return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
103
+ case 8:
104
+ _f.sent();
105
+ _f.label = 9;
106
+ case 9:
107
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
108
+ _f.label = 10;
109
+ case 10: return [2, {
99
110
  data: data,
100
111
  boardResponse: {
101
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
112
+ user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
102
113
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
103
114
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
104
115
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
105
116
  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,
117
+ name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
118
+ contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
108
119
  countries: countries,
109
120
  countryCode: countryCode,
121
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
110
122
  flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
111
123
  },
112
124
  token: token
@@ -132,16 +144,24 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
132
144
  });
133
145
  }); });
134
146
  export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
135
- var _a, sourceIncome, monthlyIncome, occupation;
147
+ var monthlyIncomeBody, dataBody, _a, sourceIncome, monthlyIncome, occupation;
136
148
  return __generator(this, function (_b) {
137
149
  switch (_b.label) {
138
- case 0: return [4, Promise.all([
139
- API.dataService.getSourceOfIncome(),
140
- API.dataService.getMonthlyIncome(countryCode),
141
- API.dataService.getOccupation()
142
- ])];
150
+ case 0:
151
+ monthlyIncomeBody = {
152
+ page: 0,
153
+ country_code: [countryCode]
154
+ };
155
+ dataBody = {
156
+ page: 0
157
+ };
158
+ return [4, Promise.all([
159
+ API.dataService.getSourceOfIncome(dataBody),
160
+ API.dataService.getMonthlyIncome(monthlyIncomeBody),
161
+ API.dataService.getOccupation(dataBody)
162
+ ])];
143
163
  case 1:
144
- _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data, occupation = _a[2];
164
+ _a = _b.sent(), sourceIncome = _a[0], monthlyIncome = _a[1], occupation = _a[2];
145
165
  return [2, {
146
166
  sourceIncome: sourceIncome,
147
167
  monthlyIncome: monthlyIncome,
@@ -159,70 +179,113 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
159
179
  case 1:
160
180
  data = _c.sent();
161
181
  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 })
182
+ 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
183
  }];
164
184
  }
165
185
  });
166
186
  }); });
167
187
  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) {
188
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, notification, _c, id, type, info, hasIndividualCompleted;
189
+ var _d, _e, _f, _g, _h, _j, _k;
190
+ return __generator(this, function (_l) {
191
+ switch (_l.label) {
172
192
  case 0:
173
193
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
174
194
  responseBody = individual.data.verify.responseBody;
195
+ _b = responseBody || {}, board_id = _b.board_id, board_info_id = _b.board_info_id;
196
+ countries = settings.data.countries;
175
197
  payload = {
176
198
  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,
199
+ service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
178
200
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
179
201
  step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
180
202
  encryption_contract: ['data']
181
203
  };
182
204
  return [4, API.leadService.verifyLeadOTP(payload)];
183
205
  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) }];
206
+ data = (_l.sent()).data;
207
+ countryCode = undefined;
208
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 10];
209
+ if (!(board_id && board_info_id)) return [3, 4];
210
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
211
+ case 2:
212
+ boardInfoData = _l.sent();
213
+ notification = (boardInfoData || {}).notification;
214
+ _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
215
+ if (!(id && type)) return [3, 4];
216
+ return [4, API.individualService.retrieveIndividual(id, type)];
217
+ case 3:
218
+ individualData = _l.sent();
219
+ _l.label = 4;
220
+ case 4:
221
+ if (!board_id) return [3, 6];
222
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
223
+ case 5:
224
+ boardData = _l.sent();
225
+ _l.label = 6;
226
+ case 6:
227
+ countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
228
+ info = boardInfoData.info;
229
+ 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';
230
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
231
+ if (!hasIndividualCompleted) return [3, 7];
232
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
233
+ return [3, 10];
234
+ case 7:
235
+ if (!countryCode) return [3, 9];
236
+ return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
237
+ case 8:
238
+ _l.sent();
239
+ _l.label = 9;
240
+ case 9:
241
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
242
+ _l.label = 10;
243
+ case 10: return [2, {
244
+ data: data,
245
+ boardResponse: {
246
+ user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
247
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
248
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
249
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
250
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
251
+ name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
252
+ contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
253
+ countries: countries,
254
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
255
+ flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
256
+ },
257
+ formData: __assign({}, params)
258
+ }];
197
259
  }
198
260
  });
199
261
  }); });
200
262
  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) {
263
+ var _a, settings, individual, _b, id, type, requestBody, data;
264
+ var _c, _d, _e, _f, _g, _h, _j, _k;
265
+ return __generator(this, function (_l) {
266
+ switch (_l.label) {
205
267
  case 0:
206
268
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
269
+ _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
270
  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,
271
+ id: id,
272
+ type: type,
273
+ occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
211
274
  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,
275
+ employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
276
+ source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
277
+ monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
215
278
  is_relative_PEP: params.isPEP,
216
279
  is_influencer: params.isInfluencer,
217
- encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'source_income[0]'],
280
+ encryption_contract: ['employer_name', 'employer_country'],
218
281
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
219
282
  };
220
- return [4, API.entityService.updateIndividualInfo(requestBody)];
283
+ return [4, API.individualService.updateIndividual(requestBody)];
221
284
  case 1:
222
- data = (_k.sent()).data;
285
+ data = (_l.sent()).data;
223
286
  if (!(data === null || data === void 0 ? void 0 : data.errors)) {
224
287
  thunkApi.dispatch(handleNextScreenStep());
225
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
288
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
226
289
  }
227
290
  return [2, { data: data, formData: params }];
228
291
  }
@@ -308,23 +371,25 @@ export var individualSlice = createSlice({
308
371
  state.error = description;
309
372
  return;
310
373
  }
311
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
374
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
312
375
  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;
376
+ var _c = boardResponse || {}, countries = _c.countries, user = _c.user, countryCode = _c.countryCode;
377
+ 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
378
  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]);
379
+ 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); })) ||
380
+ (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
317
381
  if (!!selectedSourceIncome)
318
382
  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]);
383
+ 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); })) ||
384
+ (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
320
385
  if (!!selectedMonthlyIncome)
321
386
  state.data.individualData.monthlyIncome = selectedMonthlyIncome;
322
- var code = (data === null || data === void 0 ? void 0 : data.employer_country) || countryCode;
387
+ var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
323
388
  if (!!code) {
324
389
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
325
390
  state.data.individualData.employerLocation = employerLocation;
326
391
  }
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]);
392
+ 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
393
  if (!!selectedOccupation)
329
394
  state.data.individualData.occupation = selectedOccupation;
330
395
  state.data.individualData.isPEP = is_relative_PEP;
@@ -359,7 +424,7 @@ export var individualSlice = createSlice({
359
424
  var _a;
360
425
  state.loading = false;
361
426
  state.error = null;
362
- var _b = action.payload, data = _b.data, formData = _b.formData;
427
+ var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse;
363
428
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
364
429
  if (description) {
365
430
  state.error = description;
@@ -367,7 +432,28 @@ export var individualSlice = createSlice({
367
432
  }
368
433
  state.data.otpData = formData;
369
434
  state.data.otpData.responseBody = data;
370
- state.data.individualData = __assign({}, state.data.individualData);
435
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
436
+ var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
437
+ 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;
438
+ var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
439
+ 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); })) ||
440
+ (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
441
+ if (!!selectedSourceIncome)
442
+ state.data.individualData.sourceIncome = selectedSourceIncome;
443
+ 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); })) ||
444
+ (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
445
+ if (!!selectedMonthlyIncome)
446
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
447
+ var code = user === null || user === void 0 ? void 0 : user.employer_country;
448
+ if (!!code) {
449
+ var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
450
+ state.data.individualData.employerLocation = employerLocation;
451
+ }
452
+ 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]);
453
+ if (!!selectedOccupation)
454
+ state.data.individualData.occupation = selectedOccupation;
455
+ state.data.individualData.isPEP = is_relative_PEP;
456
+ state.data.individualData.isInfluencer = is_influencer;
371
457
  })
372
458
  .addCase(verifyLeadOTP.rejected, function (state, action) {
373
459
  state.loading = false;
@@ -382,7 +468,7 @@ export var individualSlice = createSlice({
382
468
  state.error = null;
383
469
  var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, occupation = _a.occupation;
384
470
  var data = state.data.individualData.responseBody;
385
- state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [], occupationList: occupation || [] });
471
+ 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
472
  })
387
473
  .addCase(retrieveDataList.rejected, function (state, action) {
388
474
  state.loading = false;
@@ -417,8 +503,8 @@ export var individualSlice = createSlice({
417
503
  state.error = null;
418
504
  state.loading = false;
419
505
  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 });
506
+ var entity = (data || {}).entity;
507
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { entity: entity });
422
508
  })
423
509
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
424
510
  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
  });
@@ -50,13 +50,13 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { hasKey } from '../../../utils';
53
- import { handleNextScreenStep, handleCurrentActiveScreen } from '../../../app/settings';
53
+ import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2 } from '../../../app/settings';
54
54
  import { BUSINESS_FLOW_SUCCESS, TAX_STEP_NAMES } from '../../../constants';
55
55
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, data, boardData, boardInfoData, info, hasTaxCompleted;
57
- var _a, _b;
58
- return __generator(this, function (_c) {
59
- switch (_c.label) {
56
+ var payload, data, boardData, boardInfoData, info, countryIso2, hasTaxCompleted;
57
+ var _a, _b, _c;
58
+ return __generator(this, function (_d) {
59
+ switch (_d.label) {
60
60
  case 0:
61
61
  payload = {
62
62
  service_name: 'tap_email',
@@ -64,20 +64,23 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (to
64
64
  };
65
65
  return [4, API.leadService.verifyLeadToken(payload)];
66
66
  case 1:
67
- data = (_c.sent()).data;
67
+ data = (_d.sent()).data;
68
68
  boardInfoData = undefined;
69
69
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
70
70
  if (!(!!data.id && !!data.board_info_id)) return [3, 3];
71
71
  return [4, API.boardService.retrieveBoardInfo({ id: data.id, infoId: data.board_info_id })];
72
72
  case 2:
73
- boardInfoData = _c.sent();
74
- _c.label = 3;
73
+ boardInfoData = _d.sent();
74
+ _d.label = 3;
75
75
  case 3:
76
76
  info = boardInfoData.info;
77
77
  return [4, API.boardService.retrieveBoardDetails(data === null || data === void 0 ? void 0 : data.id)];
78
78
  case 4:
79
- boardData = _c.sent();
80
- hasTaxCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'tax'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
79
+ boardData = _d.sent();
80
+ countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
81
+ if (countryIso2)
82
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
83
+ hasTaxCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'tax'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
81
84
  if (hasTaxCompleted) {
82
85
  thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
83
86
  }
@@ -87,10 +90,10 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (to
87
90
  else if (data.step_name === TAX_STEP_NAMES.TAX_INFO) {
88
91
  thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
89
92
  }
90
- _c.label = 5;
93
+ _d.label = 5;
91
94
  case 5: return [2, {
92
95
  data: data,
93
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info), entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
96
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info), entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
94
97
  token: token
95
98
  }];
96
99
  }
@@ -257,8 +260,9 @@ export var taxSlice = createSlice({
257
260
  state.error = description;
258
261
  return;
259
262
  }
260
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user.name, bank_account: bank_account, vatID: vatID, merchant: merchant });
263
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user === null || user === void 0 ? void 0 : user.names, bank_account: bank_account, vatID: vatID, merchant: merchant });
261
264
  state.data.verify.token = token;
265
+ state.data.taxData.vatId = vatID;
262
266
  })
263
267
  .addCase(verifyLeadToken.pending, function (state) {
264
268
  state.error = null;
@@ -358,7 +362,7 @@ export var taxSlice = createSlice({
358
362
  return;
359
363
  }
360
364
  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 });
365
+ 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
366
  })
363
367
  .addCase(updateLeadSuccess.pending, function (state) {
364
368
  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;