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

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 (290) hide show
  1. package/build/@types/app.d.ts +59 -20
  2. package/build/@types/app.js +16 -1
  3. package/build/@types/form.d.ts +21 -7
  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 +2 -0
  22. package/build/app/rootReducer.js +5 -1
  23. package/build/app/settings.d.ts +8 -2
  24. package/build/app/settings.js +29 -12
  25. package/build/app/store.d.ts +5 -1
  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/FileInput/DragAndDrop.d.ts +10 -1
  35. package/build/components/FileInput/DragAndDrop.js +107 -8
  36. package/build/components/Lottie/Lottie.d.ts +878 -0
  37. package/build/components/Lottie/Lottie.js +58 -0
  38. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  39. package/build/components/Lottie/files/success.json +425 -0
  40. package/build/components/Lottie/index.d.ts +3 -0
  41. package/build/components/Lottie/index.js +3 -0
  42. package/build/components/OTPField/OTPField.d.ts +2 -1
  43. package/build/components/OTPField/OTPField.js +2 -2
  44. package/build/components/OTPTimer/OTPTimer.js +1 -1
  45. package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
  46. package/build/components/ProgressBar/CircularProgressBar.js +48 -0
  47. package/build/components/ProgressBar/index.d.ts +2 -0
  48. package/build/components/ProgressBar/index.js +2 -0
  49. package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
  50. package/build/components/RadioLabel/RadioLabel.js +2 -2
  51. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +1 -4
  52. package/build/components/SocialMediaGroup/SocialMediaGroup.js +3 -55
  53. package/build/constants/api.d.ts +6 -0
  54. package/build/constants/api.js +14 -1
  55. package/build/constants/app.d.ts +18 -0
  56. package/build/constants/app.js +98 -15
  57. package/build/constants/assets.d.ts +20 -1
  58. package/build/constants/assets.js +27 -8
  59. package/build/constants/dummy.d.ts +1 -1
  60. package/build/constants/dummy.js +2 -2
  61. package/build/constants/validation.d.ts +8 -0
  62. package/build/constants/validation.js +9 -1
  63. package/build/features/app/auth/authStore.d.ts +47 -0
  64. package/build/features/app/auth/authStore.js +265 -0
  65. package/build/features/app/bank/bankStore.d.ts +21 -1
  66. package/build/features/app/bank/bankStore.js +83 -39
  67. package/build/features/app/business/businessStore.d.ts +22 -3
  68. package/build/features/app/business/businessStore.js +458 -257
  69. package/build/features/app/connect/connectStore.d.ts +33 -30
  70. package/build/features/app/connect/connectStore.js +398 -258
  71. package/build/features/app/entity/entityStore.d.ts +53 -0
  72. package/build/features/app/entity/entityStore.js +461 -0
  73. package/build/features/app/individual/individualStore.d.ts +22 -1
  74. package/build/features/app/individual/individualStore.js +170 -86
  75. package/build/features/app/password/passwordStore.d.ts +10 -2
  76. package/build/features/app/password/passwordStore.js +5 -5
  77. package/build/features/app/tax/taxStore.js +6 -5
  78. package/build/features/auth/Auth.d.ts +10 -0
  79. package/build/features/auth/Auth.js +87 -0
  80. package/build/features/auth/index.d.ts +1 -0
  81. package/build/features/auth/index.js +1 -0
  82. package/build/features/auth/screens/NID/DOB.d.ts +7 -0
  83. package/build/features/auth/screens/NID/DOB.js +47 -0
  84. package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
  85. package/build/features/auth/screens/NID/IDNumber.js +64 -0
  86. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  87. package/build/features/auth/screens/NID/NID.js +67 -0
  88. package/build/features/auth/screens/NID/TAC.d.ts +3 -0
  89. package/build/features/auth/screens/NID/TAC.js +87 -0
  90. package/build/features/auth/screens/NID/index.d.ts +3 -0
  91. package/build/features/auth/screens/NID/index.js +2 -0
  92. package/build/features/auth/screens/NID/validation.d.ts +27 -0
  93. package/build/features/auth/screens/NID/validation.js +19 -0
  94. package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
  95. package/build/features/auth/screens/OTP/OTP.js +76 -0
  96. package/build/features/auth/screens/OTP/OTPInput.d.ts +5 -0
  97. package/build/features/auth/screens/OTP/OTPInput.js +51 -0
  98. package/build/features/auth/screens/OTP/index.d.ts +3 -0
  99. package/build/features/auth/screens/OTP/index.js +2 -0
  100. package/build/features/auth/screens/OTP/validation.d.ts +8 -0
  101. package/build/features/auth/screens/OTP/validation.js +4 -0
  102. package/build/features/bank/Bank.js +12 -6
  103. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
  104. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  105. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  106. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  107. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -9
  108. package/build/features/business/Business.d.ts +1 -1
  109. package/build/features/business/Business.js +14 -7
  110. package/build/features/business/screens/Activities/Activities.js +1 -6
  111. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  112. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  113. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  114. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  115. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  116. package/build/features/business/screens/Activities/validation.js +0 -9
  117. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  118. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  119. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  120. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  121. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  122. package/build/features/business/screens/BusinessType/LicenseList.js +24 -7
  123. package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
  124. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  125. package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
  126. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  127. package/build/features/business/screens/BusinessType/validation.js +50 -1
  128. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  129. package/build/features/business/screens/CivilID/CivilID.js +84 -0
  130. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  131. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  132. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  133. package/build/features/business/screens/CivilID/index.js +2 -0
  134. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  135. package/build/features/business/screens/CivilID/validation.js +4 -0
  136. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  137. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  138. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  139. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  140. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  141. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  142. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -8
  143. package/build/features/business/screens/Verify/Verify.js +4 -4
  144. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  145. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +156 -0
  146. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
  147. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +22 -0
  148. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  149. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  150. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  151. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  152. package/build/features/connect/Connect.d.ts +2 -1
  153. package/build/features/connect/Connect.js +47 -12
  154. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  155. package/build/features/connect/screens/CivilID/CivilID.js +86 -0
  156. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  157. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  158. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  159. package/build/features/connect/screens/CivilID/index.js +2 -0
  160. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  161. package/build/features/connect/screens/CivilID/validation.js +4 -0
  162. package/build/features/connect/screens/Individual/Email.js +11 -3
  163. package/build/features/connect/screens/Individual/Individual.js +27 -14
  164. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  165. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  166. package/build/features/connect/screens/Merchant/Merchant.js +47 -50
  167. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +7 -0
  168. package/build/features/connect/screens/Merchant/SalesChannels.js +113 -0
  169. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  170. package/build/features/connect/screens/Merchant/SocialMedia.js +131 -66
  171. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  172. package/build/features/connect/screens/Merchant/validation.d.ts +22 -45
  173. package/build/features/connect/screens/Merchant/validation.js +117 -116
  174. package/build/features/connect/screens/Mobile/Mobile.js +15 -6
  175. package/build/features/connect/screens/NID/NID.js +2 -1
  176. package/build/features/connect/screens/OTP/OTP.js +5 -4
  177. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  178. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  179. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +158 -0
  180. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
  181. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +22 -0
  182. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  183. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  184. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  185. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  186. package/build/features/entity/Entity.d.ts +7 -0
  187. package/build/features/entity/Entity.js +70 -0
  188. package/build/features/entity/index.d.ts +1 -0
  189. package/build/features/entity/index.js +1 -0
  190. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
  191. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +140 -0
  192. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +5 -0
  193. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +56 -0
  194. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
  195. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
  196. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
  197. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
  198. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
  199. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
  200. package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.d.ts +0 -0
  201. package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.js +8 -4
  202. package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +2 -0
  203. package/build/features/entity/screens/EntityInfoConfirm/index.js +2 -0
  204. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
  205. package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
  206. package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  207. package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  208. package/build/features/entity/screens/ResetPasswordSuccess/index.d.ts +3 -0
  209. package/build/features/entity/screens/ResetPasswordSuccess/index.js +2 -0
  210. package/build/features/entity/screens/Success/Success.d.ts +5 -0
  211. package/build/features/entity/screens/Success/Success.js +16 -0
  212. package/build/features/entity/screens/Success/index.d.ts +3 -0
  213. package/build/features/entity/screens/Success/index.js +2 -0
  214. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  215. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +110 -0
  216. package/build/features/entity/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  217. package/build/features/entity/screens/SuccessWithFlowButtons/index.js +2 -0
  218. package/build/features/entity/screens/Verify/OTPInput.d.ts +7 -0
  219. package/build/features/entity/screens/Verify/OTPInput.js +47 -0
  220. package/build/features/entity/screens/Verify/Verify.d.ts +5 -0
  221. package/build/features/entity/screens/Verify/Verify.js +78 -0
  222. package/build/features/entity/screens/Verify/index.d.ts +2 -0
  223. package/build/features/entity/screens/Verify/index.js +2 -0
  224. package/build/features/entity/screens/Verify/validation.d.ts +8 -0
  225. package/build/features/entity/screens/Verify/validation.js +4 -0
  226. package/build/features/featuresScreens.d.ts +2 -0
  227. package/build/features/featuresScreens.js +56 -0
  228. package/build/features/individual/Individual.d.ts +1 -1
  229. package/build/features/individual/Individual.js +14 -7
  230. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
  231. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  232. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  233. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  234. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -9
  235. package/build/features/individual/screens/Verify/Verify.js +4 -4
  236. package/build/features/password/Password.d.ts +1 -1
  237. package/build/features/password/Password.js +14 -7
  238. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -10
  239. package/build/features/shared/Background/Background.d.ts +7 -5
  240. package/build/features/shared/Background/Background.js +16 -5
  241. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  242. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  243. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  244. package/build/features/shared/Button/MobileButton.js +2 -2
  245. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  246. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  247. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  248. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  249. package/build/features/shared/Dialog/index.d.ts +4 -0
  250. package/build/features/shared/Dialog/index.js +4 -0
  251. package/build/features/shared/Input/Input.d.ts +1 -1
  252. package/build/features/shared/Input/Input.js +2 -2
  253. package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
  254. package/build/features/shared/UploadFile/UploadFile.d.ts +9 -3
  255. package/build/features/shared/UploadFile/UploadFile.js +23 -8
  256. package/build/features/signIn/SignIn.d.ts +1 -1
  257. package/build/features/signIn/SignIn.js +14 -6
  258. package/build/features/tax/Tax.d.ts +1 -1
  259. package/build/features/tax/Tax.js +16 -8
  260. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  261. package/build/hooks/index.d.ts +1 -0
  262. package/build/hooks/index.js +1 -0
  263. package/build/hooks/useAppConfig.d.ts +3 -1
  264. package/build/hooks/useAppConfig.js +4 -2
  265. package/build/hooks/useAppDispatch.d.ts +2 -0
  266. package/build/hooks/useErrorListener.js +0 -5
  267. package/build/hooks/useScreen.d.ts +3 -0
  268. package/build/hooks/useScreen.js +14 -0
  269. package/build/index.d.ts +4 -2
  270. package/build/index.js +8 -2
  271. package/build/utils/array.d.ts +13 -1
  272. package/build/utils/array.js +26 -0
  273. package/build/utils/common.d.ts +1 -0
  274. package/build/utils/common.js +3 -0
  275. package/build/utils/device.d.ts +1 -0
  276. package/build/utils/device.js +13 -0
  277. package/build/utils/html.d.ts +1 -0
  278. package/build/utils/html.js +6 -0
  279. package/build/utils/index.d.ts +1 -0
  280. package/build/utils/index.js +1 -0
  281. package/build/utils/locale.js +1 -1
  282. package/build/utils/object.d.ts +1 -0
  283. package/build/utils/object.js +12 -0
  284. package/build/utils/rsa.d.ts +2 -2
  285. package/build/utils/rsa.js +1 -1
  286. package/build/utils/string.d.ts +33 -20
  287. package/build/utils/string.js +71 -1
  288. package/build/utils/validation.d.ts +2 -0
  289. package/build/utils/validation.js +6 -0
  290. package/package.json +129 -128
@@ -59,14 +59,14 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType, FlowsTypes } from '../../../@types';
62
- import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
- import { convertNumbers2English, getEighteenYearsAgo, hasKey } from '../../../utils';
64
- import { handleNextScreenStep } from '../../../app/settings';
62
+ import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
+ import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW, isSA } from '../../../utils';
64
+ import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
65
65
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
- var payload, data, leadResponse, brandInfo, boardResponse, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
67
- var _a, _b, _c, _d, _e, _f;
68
- return __generator(this, function (_g) {
69
- switch (_g.label) {
66
+ var payload, data, leadResponse, brandInfo, boardResponse, countryIso2, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, entity_activities, data_1, board_id, board_info_id;
67
+ var _a, _b, _c, _d, _e, _f, _g;
68
+ return __generator(this, function (_h) {
69
+ switch (_h.label) {
70
70
  case 0:
71
71
  payload = {
72
72
  service_name: 'tap_email',
@@ -74,80 +74,92 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
74
74
  };
75
75
  return [4, API.leadService.verifyLeadToken(payload)];
76
76
  case 1:
77
- data = (_g.sent()).data;
77
+ data = (_h.sent()).data;
78
78
  leadResponse = undefined;
79
79
  brandInfo = undefined;
80
80
  boardResponse = undefined;
81
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 17];
81
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 18];
82
+ if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 18];
82
83
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
83
84
  case 2:
84
- leadResponse = _g.sent();
85
- board_id = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.board_id;
86
- board_info_id = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.board_info_id;
87
- if (!(!!board_id && !!board_info_id)) return [3, 4];
88
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
89
- case 3:
90
- boardResponse = _g.sent();
91
- _g.label = 4;
92
- case 4:
93
- if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
85
+ leadResponse = _h.sent();
86
+ countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
87
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
88
+ if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
89
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
90
+ }
91
+ if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
94
92
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
95
93
  }
96
- if (!(data.step_name === 'business_info')) return [3, 17];
97
- steps = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.steps;
98
- brandID = (_e = (_d = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
94
+ if (!(data.step_name === 'business_info')) return [3, 18];
95
+ steps = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.steps;
96
+ brandID = (_d = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.id;
99
97
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
100
- hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
98
+ hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) &&
99
+ hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
101
100
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
102
101
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
103
- if (!hasBusinessCompleted) return [3, 6];
104
- return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
102
+ entity_activities = leadResponse.data.entity_activities;
103
+ if (!(!entity_activities && hasBusinessCRInfoCompleted)) return [3, 4];
104
+ return [4, API.dataService.getActivities()];
105
+ case 3:
106
+ data_1 = _h.sent();
107
+ leadResponse.data = __assign(__assign({}, leadResponse.data), { entity_activities: data_1.list });
108
+ _h.label = 4;
109
+ case 4:
110
+ if (!hasBusinessCompleted) return [3, 8];
111
+ board_id = (_e = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _e === void 0 ? void 0 : _e.board_id;
112
+ board_info_id = (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_info_id;
113
+ if (!(!!board_id && !!board_info_id)) return [3, 6];
114
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
105
115
  case 5:
106
- _g.sent();
107
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
108
- return [3, 17];
109
- case 6:
110
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 7];
111
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
112
- return [3, 17];
116
+ boardResponse = _h.sent();
117
+ _h.label = 6;
118
+ case 6: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
113
119
  case 7:
114
- if (!hasBusinessCustomersCompleted) return [3, 8];
115
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
116
- return [3, 17];
120
+ _h.sent();
121
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
122
+ return [3, 18];
117
123
  case 8:
118
- if (!hasBusinessCRActivitiesCompleted) return [3, 12];
119
- return [4, thunkApi.dispatch(retrieveChannels())];
124
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
125
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
126
+ return [3, 18];
120
127
  case 9:
121
- _g.sent();
122
- return [4, thunkApi.dispatch(retrieveDataList())];
128
+ if (!hasBusinessCustomersCompleted) return [3, 10];
129
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
130
+ return [3, 18];
123
131
  case 10:
124
- _g.sent();
132
+ if (!hasBusinessCRActivitiesCompleted) return [3, 13];
133
+ return [4, thunkApi.dispatch(retrieveDataList())];
134
+ case 11:
135
+ _h.sent();
125
136
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
126
137
  return [4, API.brandService.retrieveBrand(brandID)];
127
- case 11:
128
- brandInfo = _g.sent();
129
- return [3, 17];
130
138
  case 12:
131
- if (!hasBusinessCRInfoCompleted) return [3, 15];
132
- return [4, thunkApi.dispatch(retrieveChannels())];
139
+ brandInfo = _h.sent();
140
+ return [3, 18];
133
141
  case 13:
134
- _g.sent();
142
+ if (!hasBusinessCRInfoCompleted) return [3, 15];
135
143
  return [4, API.brandService.retrieveBrand(brandID)];
136
144
  case 14:
137
- brandInfo = _g.sent();
145
+ brandInfo = _h.sent();
138
146
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
139
- return [3, 17];
140
- case 15: return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
147
+ return [3, 18];
148
+ case 15:
149
+ if (!isSA(countryIso2)) return [3, 17];
150
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
141
151
  case 16:
142
- _g.sent();
152
+ _h.sent();
153
+ _h.label = 17;
154
+ case 17:
143
155
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
144
- _g.label = 17;
145
- case 17: return [2, {
156
+ _h.label = 18;
157
+ case 18: return [2, {
146
158
  data: data,
147
- leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info }),
159
+ leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: BUSINESS_FLOW_SUCCESS.concat(boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) }),
148
160
  token: token,
149
161
  brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand,
150
- boardId: (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_id
162
+ boardId: (_g = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _g === void 0 ? void 0 : _g.board_id
151
163
  }];
152
164
  }
153
165
  });
@@ -170,144 +182,241 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
170
182
  });
171
183
  }); });
172
184
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
173
- var _a, business, settings, isNID, responseBody, verifyResponse, stepName, brandID, payload, data, brandInfo, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
174
- var _b, _c, _d, _e, _f, _g, _h, _j;
175
- return __generator(this, function (_k) {
176
- switch (_k.label) {
185
+ var _a, business, settings, isNID, responseBody, stepName, payload, data, brandInfo, leadResponse, _b, brand, country_code, steps, board_id, board_info_id, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, data_2, boardResponse;
186
+ var _c, _d, _e, _f, _g, _h;
187
+ return __generator(this, function (_j) {
188
+ switch (_j.label) {
177
189
  case 0:
178
190
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
179
191
  isNID = business.data.otpData.isNID;
180
192
  responseBody = (isNID ? business.data.nidData : business.data.verify).responseBody;
181
- verifyResponse = business.data.verify.responseBody;
182
193
  stepName = isNID ? BUSINESS_STEP_NAMES.IDENTITY_VERIFY_AUTH : BUSINESS_STEP_NAMES.PHONE_AUTH;
183
- brandID = (_c = (_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
184
194
  payload = {
185
195
  data: params.otp,
186
- service_name: ((_e = (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _d === void 0 ? void 0 : _d.verification_by) === null || _e === void 0 ? void 0 : _e.service_name) || ((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _f === void 0 ? void 0 : _f.service_name),
187
- verify_token: ((_g = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _g === void 0 ? void 0 : _g.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
196
+ service_name: ((_d = (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _c === void 0 ? void 0 : _c.verification_by) === null || _d === void 0 ? void 0 : _d.service_name) || ((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name),
197
+ verify_token: ((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _f === void 0 ? void 0 : _f.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
188
198
  step_name: stepName,
189
199
  encryption_contract: ['data']
190
200
  };
191
201
  return [4, API.leadService.verifyLeadOTP(payload)];
192
202
  case 1:
193
- data = (_k.sent()).data;
203
+ data = (_j.sent()).data;
194
204
  brandInfo = undefined;
195
- if (!!data.errors) return [3, 13];
196
- thunkApi.dispatch(updateStepName(stepName));
197
- return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
205
+ leadResponse = undefined;
206
+ if (!!data.errors) return [3, 20];
207
+ return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
198
208
  case 2:
199
- _k.sent();
200
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
201
- steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
209
+ leadResponse = _j.sent();
210
+ thunkApi.dispatch(updateStepName(stepName));
211
+ _b = (leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) || {}, brand = _b.brand, country_code = _b.country_code, steps = _b.steps, board_id = _b.board_id, board_info_id = _b.board_info_id;
212
+ brandID = brand === null || brand === void 0 ? void 0 : brand.id;
213
+ countryIso2 = country_code;
214
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
215
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
202
216
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
203
217
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
204
218
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
205
219
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
206
- if (!isNID) return [3, 3];
207
- thunkApi.dispatch(handleNextScreenStep());
208
- return [3, 13];
220
+ isIdentityAuthStep = data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH;
221
+ if (!isSA(countryIso2)) return [3, 4];
222
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
209
223
  case 3:
210
- if (!hasBusinessCompleted) return [3, 5];
211
- return [4, thunkApi.dispatch(retrieveBoardDetails(verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.board_id))];
224
+ _j.sent();
225
+ _j.label = 4;
212
226
  case 4:
213
- _k.sent();
214
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
215
- return [3, 13];
227
+ entity_activities = ((leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) || {}).entity_activities;
228
+ if (!(!entity_activities && hasBusinessCRInfoCompleted)) return [3, 6];
229
+ return [4, API.dataService.getActivities()];
216
230
  case 5:
217
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 6];
218
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
219
- return [3, 13];
231
+ data_2 = _j.sent();
232
+ leadResponse.data = __assign(__assign({}, leadResponse.data), { entity_activities: data_2.list });
233
+ _j.label = 6;
220
234
  case 6:
221
- if (!hasBusinessCustomersCompleted) return [3, 7];
222
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
223
- return [3, 13];
235
+ if (!isNID) return [3, 7];
236
+ thunkApi.dispatch(handleNextScreenStep());
237
+ return [3, 20];
224
238
  case 7:
225
- if (!hasBusinessCRActivitiesCompleted) return [3, 9];
226
- thunkApi.dispatch(retrieveChannels());
227
- thunkApi.dispatch(retrieveDataList());
228
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
229
- return [4, API.brandService.retrieveBrand(brandID)];
239
+ if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 8];
240
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
241
+ return [3, 20];
230
242
  case 8:
231
- brandInfo = _k.sent();
232
- return [3, 13];
243
+ if (!hasBusinessCompleted) return [3, 12];
244
+ if (!(!!board_id && !!board_info_id)) return [3, 10];
245
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
233
246
  case 9:
234
- if (!hasBusinessCRInfoCompleted) return [3, 12];
235
- return [4, thunkApi.dispatch(retrieveChannels())];
236
- case 10:
237
- _k.sent();
238
- return [4, API.brandService.retrieveBrand(brandID)];
247
+ boardResponse = _j.sent();
248
+ leadResponse.data = __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: BUSINESS_FLOW_SUCCESS.concat(boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) });
249
+ _j.label = 10;
250
+ case 10: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
239
251
  case 11:
240
- brandInfo = _k.sent();
241
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
242
- return [3, 13];
252
+ _j.sent();
253
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
254
+ return [3, 20];
243
255
  case 12:
256
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 13];
257
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
258
+ return [3, 20];
259
+ case 13:
260
+ if (!hasBusinessCustomersCompleted) return [3, 14];
261
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
262
+ return [3, 20];
263
+ case 14:
264
+ if (!hasBusinessCRActivitiesCompleted) return [3, 17];
265
+ return [4, thunkApi.dispatch(retrieveDataList())];
266
+ case 15:
267
+ _j.sent();
268
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
269
+ return [4, API.brandService.retrieveBrand(brandID)];
270
+ case 16:
271
+ brandInfo = _j.sent();
272
+ return [3, 20];
273
+ case 17:
274
+ if (!hasBusinessCRInfoCompleted) return [3, 19];
275
+ return [4, API.brandService.retrieveBrand(brandID)];
276
+ case 18:
277
+ brandInfo = _j.sent();
278
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
279
+ return [3, 20];
280
+ case 19:
244
281
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
245
- _k.label = 13;
246
- case 13: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand }];
282
+ _j.label = 20;
283
+ case 20: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data }];
284
+ }
285
+ });
286
+ }); });
287
+ export var verifyPACI = createAsyncThunk('businessVerifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
288
+ var _a, settings, business, responseBody, expiry, interval, maxCalls, response, count, data, isSuccess;
289
+ var _b, _c, _d, _e;
290
+ return __generator(this, function (_f) {
291
+ switch (_f.label) {
292
+ case 0:
293
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
294
+ responseBody = business.data.civilIdData.responseBody;
295
+ expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
296
+ interval = 5;
297
+ maxCalls = Math.floor(expiry / interval);
298
+ response = null;
299
+ if (thunkApi.signal.aborted) {
300
+ return [2, { response: null }];
301
+ }
302
+ count = 1;
303
+ _f.label = 1;
304
+ case 1:
305
+ if (!(count <= maxCalls)) return [3, 7];
306
+ return [4, API.authService.getTokenVerify(responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token)];
307
+ case 2:
308
+ data = _f.sent();
309
+ response = data;
310
+ isSuccess = ((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
311
+ if (!isSuccess) return [3, 4];
312
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, {});
313
+ return [4, ((_e = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _e === void 0 ? void 0 : _e.call(params))];
314
+ case 3:
315
+ _f.sent();
316
+ thunkApi.dispatch(handleNextScreenStep());
317
+ return [3, 7];
318
+ case 4: return [4, sleep(interval * 1000)];
319
+ case 5:
320
+ _f.sent();
321
+ _f.label = 6;
322
+ case 6:
323
+ count++;
324
+ return [3, 1];
325
+ case 7: return [2, { response: response }];
326
+ }
327
+ });
328
+ }); });
329
+ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
330
+ var _a, settings, business, stepName, lead_id, requestBody, data;
331
+ var _b, _c;
332
+ return __generator(this, function (_d) {
333
+ switch (_d.label) {
334
+ case 0:
335
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
336
+ stepName = BUSINESS_STEP_NAMES.CREATE_AUTH_CIVIL_ID;
337
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
338
+ requestBody = {
339
+ id: lead_id || '',
340
+ identification: {
341
+ id: params.civilId,
342
+ issued_country_code: settings.data.businessCountry.iso2,
343
+ type: 'civil_id'
344
+ },
345
+ step_name: stepName,
346
+ encryption_contract: ['identification.id', 'identification.issued_country_code', 'identification.type']
347
+ };
348
+ return [4, API.leadService.updateLead(requestBody)];
349
+ case 1:
350
+ data = _d.sent();
351
+ thunkApi.dispatch(handleNextScreenStep());
352
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
353
+ return [2, { response: data, formData: params }];
247
354
  }
248
355
  });
249
356
  }); });
250
357
  export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
251
- var _a, settings, business, identification_id_type, stepName, requestBody, data;
252
- var _b, _c, _d;
253
- return __generator(this, function (_e) {
254
- switch (_e.label) {
358
+ var _a, settings, business, identification_id_type, stepName, lead_id, requestBody, data;
359
+ var _b, _c;
360
+ return __generator(this, function (_d) {
361
+ switch (_d.label) {
255
362
  case 0:
256
363
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
257
364
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
258
365
  stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
366
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
259
367
  requestBody = {
260
- id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
261
- identification_id: params.nid,
262
- identification_id_type: identification_id_type,
368
+ id: lead_id || '',
369
+ identification: {
370
+ id: params.nid,
371
+ issued_country_code: settings.data.businessCountry.iso2,
372
+ type: identification_id_type
373
+ },
263
374
  date_of_birth: params.dob,
264
- country_code: settings.data.businessCountry.iso2,
265
375
  step_name: stepName,
266
- encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
376
+ encryption_contract: [
377
+ 'identification.issued_country_code',
378
+ 'identification.id',
379
+ 'identification.type',
380
+ 'date_of_birth'
381
+ ]
267
382
  };
268
383
  return [4, API.leadService.updateLead(requestBody)];
269
384
  case 1:
270
- data = _e.sent();
271
- thunkApi.dispatch(updateStepName(stepName));
385
+ data = _d.sent();
272
386
  thunkApi.dispatch(handleNextScreenStep());
273
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
387
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
274
388
  return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
275
389
  }
276
390
  });
277
391
  }); });
278
392
  export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
279
- var _a, settings, business, _b, nid, dob, type, stepName, requestBody, data;
280
- var _c;
281
- return __generator(this, function (_d) {
282
- switch (_d.label) {
393
+ var _a, settings, business, _b, nid, dob, type, stepName, lead_id, requestBody, data;
394
+ return __generator(this, function (_c) {
395
+ switch (_c.label) {
283
396
  case 0:
284
397
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
285
398
  _b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
286
399
  stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
400
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
287
401
  requestBody = {
288
- id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
289
- identification_id: nid,
290
- identification_id_type: type,
402
+ id: lead_id || '',
403
+ identification: {
404
+ id: nid,
405
+ issued_country_code: settings.data.businessCountry.iso2,
406
+ type: type
407
+ },
291
408
  date_of_birth: dob,
292
- country_code: settings.data.businessCountry.iso2,
293
409
  step_name: stepName,
294
- encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
410
+ encryption_contract: [
411
+ 'identification.issued_country_code',
412
+ 'identification.id',
413
+ 'identification.type',
414
+ 'date_of_birth'
415
+ ]
295
416
  };
296
417
  return [4, API.leadService.updateLead(requestBody)];
297
418
  case 1:
298
- data = _d.sent();
299
- thunkApi.dispatch(updateStepName(stepName));
300
- return [2, data];
301
- }
302
- });
303
- }); });
304
- export var retrieveChannels = createAsyncThunk('retrieveChannels', function () { return __awaiter(void 0, void 0, void 0, function () {
305
- var data;
306
- return __generator(this, function (_a) {
307
- switch (_a.label) {
308
- case 0: return [4, API.dataService.getChannelsOfServices()];
309
- case 1:
310
- data = (_a.sent()).data;
419
+ data = _c.sent();
311
420
  return [2, data];
312
421
  }
313
422
  });
@@ -332,31 +441,40 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
332
441
  case 1:
333
442
  data = _c.sent();
334
443
  return [2, {
335
- 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 })
444
+ 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 })
336
445
  }];
337
446
  }
338
447
  });
339
448
  }); });
340
449
  export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
341
- var _a, settings, business, payload, data, accountBody, accountData;
450
+ var _a, settings, business, payload, data, entity_activities, list, accountBody, accountData, documentData, documentBody;
342
451
  var _b, _c, _d, _e, _f, _g;
343
452
  return __generator(this, function (_h) {
344
453
  switch (_h.label) {
345
454
  case 0:
346
455
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
347
456
  payload = {
348
- id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
457
+ id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
349
458
  license_number: params.licenseNumber,
350
459
  license_type: ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL ? 'freelance' : 'commercial_registration',
351
460
  business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
352
461
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
462
+ business: { ar: params.entityLegalName, en: params.entityLegalName },
353
463
  encryption_contract: ['license_number', 'business_type', 'license_type']
354
464
  };
355
465
  return [4, API.leadService.updateLead(payload)];
356
466
  case 1:
357
467
  data = _h.sent();
468
+ entity_activities = data.entity_activities;
469
+ if (!!entity_activities) return [3, 3];
470
+ return [4, API.dataService.getActivities()];
471
+ case 2:
472
+ list = (_h.sent()).list;
473
+ data.entity_activities = list;
474
+ _h.label = 3;
475
+ case 3:
358
476
  accountBody = {
359
- lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.id,
477
+ lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.lead_id,
360
478
  notify: {
361
479
  email: false,
362
480
  phone: false
@@ -366,43 +484,75 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
366
484
  step_name: BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM
367
485
  };
368
486
  return [4, API.accountService.createAccount(accountBody)];
369
- case 2:
487
+ case 4:
370
488
  accountData = _h.sent();
371
- return [4, thunkApi.dispatch(retrieveChannels())];
372
- case 3:
373
- _h.sent();
489
+ documentData = undefined;
490
+ if (!!!business.data.businessTypeData.certificateId) return [3, 6];
491
+ documentBody = {
492
+ entity_id: (accountData === null || accountData === void 0 ? void 0 : accountData.entity_id) || '',
493
+ documents: [
494
+ {
495
+ images: [business.data.businessTypeData.certificateId]
496
+ }
497
+ ]
498
+ };
499
+ return [4, API.entityService.updateDocumentInfo(documentBody)];
500
+ case 5:
501
+ documentData = _h.sent();
502
+ _h.label = 6;
503
+ case 6:
374
504
  thunkApi.dispatch(handleNextScreenStep());
375
505
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
376
- return [2, { data: data, formData: params, accountData: accountData }];
506
+ return [2, { data: data, formData: params, accountData: accountData, documentData: documentData }];
377
507
  }
378
508
  });
379
509
  }); });
510
+ export var uploadLicenseCertificate = createAsyncThunk('uploadLicenseCertificate', function (_a) {
511
+ var file = _a.file, onProgress = _a.onProgress;
512
+ return __awaiter(void 0, void 0, void 0, function () {
513
+ var uploadPayload, onUploadProgress, data;
514
+ return __generator(this, function (_b) {
515
+ switch (_b.label) {
516
+ case 0:
517
+ uploadPayload = {
518
+ file_link_create: true,
519
+ title: file === null || file === void 0 ? void 0 : file.name,
520
+ purpose: 'identity_document',
521
+ file: file
522
+ };
523
+ onUploadProgress = function (progressEvent) {
524
+ var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
525
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
526
+ };
527
+ return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
528
+ case 1:
529
+ data = _b.sent();
530
+ return [2, { data: data }];
531
+ }
532
+ });
533
+ });
534
+ });
380
535
  export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
381
- var _a, settings, business, channel, activities, stepName, id, requestBody, data;
536
+ var _a, settings, business, activities, stepName, id, requestBody, data;
382
537
  var _b, _c, _d, _e, _f;
383
538
  return __generator(this, function (_g) {
384
539
  switch (_g.label) {
385
540
  case 0:
386
541
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
387
- channel = params.salesChannels.map(function (_a) {
388
- var id = _a.id;
389
- return id;
390
- });
391
542
  activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
392
- var en = _a.en;
393
- return en;
543
+ var id = _a.id;
544
+ return ({ id: id });
394
545
  });
395
546
  stepName = BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES;
396
547
  id = (_d = (_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.id;
397
548
  requestBody = {
398
549
  id: id,
399
- brand: {
400
- activities: activities,
401
- channel_services: channel,
402
- business_operation_start_at: params.operationStartDate
550
+ activities: activities,
551
+ operations: {
552
+ start_date: params.operationStartDate
403
553
  },
404
554
  step_name: stepName,
405
- encryption_contract: ['brand.business_operation_start_at']
555
+ encryption_contract: ['operations.start_date']
406
556
  };
407
557
  return [4, API.brandService.updateBrandInfo(requestBody)];
408
558
  case 1:
@@ -415,17 +565,26 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
415
565
  }
416
566
  });
417
567
  }); });
418
- export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
419
- var _a, customerBases, expectedSales, expectedCustomerSales;
568
+ export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
569
+ var settings, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
420
570
  return __generator(this, function (_b) {
421
571
  switch (_b.label) {
422
- case 0: return [4, Promise.all([
423
- API.dataService.getCustomerBases(),
424
- API.dataService.getExpectedSales(),
425
- API.dataService.getExpectedCustomerSales()
426
- ])];
572
+ case 0:
573
+ settings = thunkApi.getState().settings;
574
+ dataBody = {
575
+ page: 0
576
+ };
577
+ salesDataBody = {
578
+ page: 0,
579
+ country_code: [settings.data.businessCountry.iso2]
580
+ };
581
+ return [4, Promise.all([
582
+ API.dataService.getCustomerBases(dataBody),
583
+ API.dataService.getExpectedSales(salesDataBody),
584
+ API.dataService.getExpectedCustomerSales(dataBody)
585
+ ])];
427
586
  case 1:
428
- _a = _b.sent(), customerBases = _a[0].data, expectedSales = _a[1].data, expectedCustomerSales = _a[2].data;
587
+ _a = _b.sent(), customerBases = _a[0], expectedSales = _a[1], expectedCustomerSales = _a[2];
429
588
  return [2, {
430
589
  customerBases: customerBases,
431
590
  expectedSales: expectedSales,
@@ -435,29 +594,28 @@ export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function
435
594
  });
436
595
  }); });
437
596
  export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
438
- var _a, settings, business, id, customerBase, stepName, requestBody, data;
597
+ var _a, settings, business, id, customerLocation, customerBase, sales, stepName, requestBody, data;
439
598
  var _b, _c, _d, _e, _f, _g;
440
599
  return __generator(this, function (_h) {
441
600
  switch (_h.label) {
442
601
  case 0:
443
602
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
444
603
  id = (_c = (_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
445
- customerBase = params.customerLocations.map(function (_a) {
446
- var id = _a.id;
447
- return id;
448
- });
604
+ customerLocation = params.customerLocations.map(function (location) { return ({
605
+ id: location === null || location === void 0 ? void 0 : location.id
606
+ }); });
607
+ customerBase = { id: ((_d = params.expectedCustomer) === null || _d === void 0 ? void 0 : _d.id) || '', period: 'monthly', locations: customerLocation };
608
+ sales = { id: ((_e = params.expectedSale) === null || _e === void 0 ? void 0 : _e.id) || '', period: 'monthly' };
449
609
  stepName = BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS;
450
610
  requestBody = {
451
- brand: {
452
- customers_base: customerBase,
453
- customers_served_monthly: parseInt(((_d = params.expectedCustomer) === null || _d === void 0 ? void 0 : _d.id) || '0'),
454
- monthly_sales_range: ((_e = params.expectedSale) === null || _e === void 0 ? void 0 : _e.id) || '',
455
- agree_refund: params.refundPolicy,
456
- agree_chargeback: params.transactionPolicy
611
+ operations: {
612
+ customer_base: customerBase,
613
+ sales: sales
457
614
  },
615
+ term: ['refund', 'chargeback'],
458
616
  id: id,
459
617
  step_name: stepName,
460
- encryption_contract: ['brand.customers_served_monthly', 'brand.monthly_sales_range']
618
+ encryption_contract: []
461
619
  };
462
620
  return [4, API.brandService.updateBrandInfo(requestBody)];
463
621
  case 1:
@@ -470,21 +628,21 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
470
628
  });
471
629
  }); });
472
630
  export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
473
- var _a, settings, business, _b, steps, id, flowCompleted, boardResponse, payload, data, board_id, board_info_id;
631
+ var _a, settings, business, _b, steps, lead_id, flowCompleted, boardResponse, payload, data, board_id, board_info_id;
474
632
  var _c, _d, _e, _f;
475
633
  return __generator(this, function (_g) {
476
634
  switch (_g.label) {
477
635
  case 0:
478
636
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
479
- _b = business.data.verify.responseBody || {}, steps = _b.steps, id = _b.id;
637
+ _b = business.data.verify.responseBody || {}, steps = _b.steps, lead_id = _b.lead_id;
480
638
  flowCompleted = Object.keys(steps).find(function (key) { return key === BUSINESS_STEP_NAMES.BUSINESS_SUCCESS; });
481
- if (flowCompleted || !id)
639
+ if (flowCompleted || !lead_id)
482
640
  return [2];
483
641
  boardResponse = undefined;
484
642
  payload = {
485
643
  lang: settings.data.language,
486
644
  step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
487
- id: id,
645
+ id: lead_id,
488
646
  encryption_contract: []
489
647
  };
490
648
  return [4, API.leadService.updateLead(payload)];
@@ -497,11 +655,16 @@ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', fun
497
655
  case 2:
498
656
  boardResponse = _g.sent();
499
657
  _g.label = 3;
500
- case 3:
658
+ case 3: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
659
+ case 4:
660
+ _g.sent();
501
661
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
502
662
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
503
663
  thunkApi.dispatch(handleNextScreenStep());
504
- return [2, { response: __assign(__assign({}, data), { flows: boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info }), formData: params }];
664
+ return [2, {
665
+ response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) }),
666
+ formData: params
667
+ }];
505
668
  }
506
669
  });
507
670
  }); });
@@ -514,7 +677,7 @@ export var updateStepName = createAsyncThunk('updateStepName', function (stepNam
514
677
  business = thunkApi.getState().business;
515
678
  payload = {
516
679
  step_name: stepName,
517
- id: ((_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id) || '',
680
+ id: ((_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.lead_id) || '',
518
681
  encryption_contract: []
519
682
  };
520
683
  return [4, API.leadService.updateLead(payload)];
@@ -528,6 +691,7 @@ var initialState = {
528
691
  error: null,
529
692
  loading: false,
530
693
  customLoading: false,
694
+ uploading: false,
531
695
  data: {
532
696
  flowName: FlowsTypes.BUSINESS,
533
697
  verify: {
@@ -537,18 +701,22 @@ var initialState = {
537
701
  otp: '',
538
702
  isNID: false
539
703
  },
704
+ civilIdData: {
705
+ civilId: ''
706
+ },
540
707
  nidData: {
541
708
  nid: '',
542
709
  dob: getEighteenYearsAgo(),
543
710
  type: ''
544
711
  },
545
712
  businessTypeData: {
546
- licenseNumber: ''
713
+ licenseNumber: '',
714
+ entityLegalName: '',
715
+ uploading: false
547
716
  },
548
717
  activitiesData: {
549
718
  activities: [],
550
- salesChannels: [],
551
- operationStartDate: '1998-08-22'
719
+ operationStartDate: new Date().toString()
552
720
  },
553
721
  customersData: {
554
722
  customerLocations: [],
@@ -589,10 +757,10 @@ export var businessSlice = createSlice({
589
757
  state.error = description;
590
758
  return;
591
759
  }
592
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId });
760
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id });
593
761
  state.data.verify.token = token;
594
762
  state.data.otpData.isNID = false;
595
- var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
763
+ var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type, business_name = _f.business_name;
596
764
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
597
765
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
598
766
  : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
@@ -600,25 +768,30 @@ export var businessSlice = createSlice({
600
768
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
601
769
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
602
770
  }
603
- var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
604
- var selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
605
- var _a;
606
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
607
- });
608
- state.data.activitiesData.salesChannels = (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0 ? selectedChannels : [channels === null || channels === void 0 ? void 0 : channels[0]];
609
771
  var activities = entity_activities || [];
610
772
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
611
773
  var _a;
612
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { var _a; return ((_a = activity.en) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === value.toLowerCase(); });
774
+ return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return activity.id === value.id; });
613
775
  });
614
776
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
615
777
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
778
+ state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
616
779
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
617
- state.data.businessTypeData.selectedLicense = {
618
- legal_name: entity === null || entity === void 0 ? void 0 : entity.legal_name,
619
- license: { number: (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number },
620
- type: business_type
621
- };
780
+ var licenseNumber_1 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
781
+ var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
782
+ var licenseList = (responseBody || {}).licenseList;
783
+ var selectedLicenseData = selectedLicense;
784
+ if (!!licenseNumber_1) {
785
+ selectedLicenseData =
786
+ ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
787
+ var license = _a.license;
788
+ return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_1;
789
+ })) ||
790
+ business_type === BusinessType.FL
791
+ ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } });
792
+ state.data.businessTypeData.licenseNumber = licenseNumber_1 || '';
793
+ }
794
+ state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
622
795
  }
623
796
  })
624
797
  .addCase(verifyLeadToken.rejected, function (state, action) {
@@ -647,10 +820,10 @@ export var businessSlice = createSlice({
647
820
  state.error = null;
648
821
  })
649
822
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
650
- var _a, _b, _c, _d;
823
+ var _a, _b, _c, _d, _e;
651
824
  state.loading = false;
652
825
  state.error = null;
653
- var _e = action.payload, data = _e.data, formData = _e.formData, brandInfo = _e.brandInfo;
826
+ var _f = action.payload, data = _f.data, formData = _f.formData, brandInfo = _f.brandInfo, leadData = _f.leadData;
654
827
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
655
828
  if (description) {
656
829
  state.error = description;
@@ -658,38 +831,80 @@ export var businessSlice = createSlice({
658
831
  }
659
832
  state.data.otpData = formData;
660
833
  state.data.otpData.responseBody = data;
661
- var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
834
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), leadData), { name: (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.name });
835
+ var _g = leadData || {}, entity = _g.entity, entity_activities = _g.entity_activities, business_type = _g.business_type, business_name = _g.business_name;
662
836
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
663
837
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
664
- : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
838
+ : (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
665
839
  if (!!issuingDate) {
666
840
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
667
841
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
668
842
  }
669
- var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
670
- var selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
671
- var _a;
672
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
673
- });
674
- state.data.activitiesData.salesChannels = (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0 ? selectedChannels : [channels === null || channels === void 0 ? void 0 : channels[0]];
675
843
  var activities = entity_activities || [];
676
844
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
677
845
  var _a;
678
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { var _a; return ((_a = activity.en) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === value.toLowerCase(); });
846
+ return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
679
847
  });
680
848
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
681
849
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
850
+ state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
682
851
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
683
- state.data.businessTypeData.selectedLicense = {
684
- legal_name: entity === null || entity === void 0 ? void 0 : entity.legal_name,
685
- license: { number: (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number },
686
- type: business_type
687
- };
852
+ var licenseNumber_2 = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
853
+ var _h = state.data.businessTypeData || {}, responseBody = _h.responseBody, selectedLicense = _h.selectedLicense;
854
+ var licenseList = (responseBody || {}).licenseList;
855
+ var selectedLicenseData = selectedLicense;
856
+ if (!!licenseNumber_2) {
857
+ selectedLicenseData =
858
+ ((_e = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _e === void 0 ? void 0 : _e.call(licenseList, function (_a) {
859
+ var license = _a.license;
860
+ return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
861
+ })) ||
862
+ business_type === BusinessType.FL
863
+ ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } });
864
+ state.data.businessTypeData.licenseNumber = licenseNumber_2 || '';
865
+ }
866
+ state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
688
867
  }
689
868
  })
690
869
  .addCase(verifyLeadOTP.rejected, function (state, action) {
691
870
  state.loading = false;
692
871
  state.error = action.error.message;
872
+ })
873
+ .addCase(createCivilIdAuth.pending, function (state, action) {
874
+ state.loading = true;
875
+ state.error = null;
876
+ })
877
+ .addCase(createCivilIdAuth.fulfilled, function (state, action) {
878
+ var _a;
879
+ state.loading = false;
880
+ state.error = null;
881
+ var _b = action.payload, formData = _b.formData, response = _b.response;
882
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
883
+ if (description) {
884
+ state.error = description;
885
+ return;
886
+ }
887
+ state.data.civilIdData = __assign(__assign({}, formData), { responseBody: response });
888
+ })
889
+ .addCase(createCivilIdAuth.rejected, function (state, action) {
890
+ state.loading = false;
891
+ state.error = action.error.message;
892
+ })
893
+ .addCase(verifyPACI.pending, function (state) {
894
+ state.loading = true;
895
+ state.error = null;
896
+ })
897
+ .addCase(verifyPACI.fulfilled, function (state, action) {
898
+ state.loading = false;
899
+ state.error = null;
900
+ state.data.otpData.responseBody = action.payload.response;
901
+ })
902
+ .addCase(verifyPACI.rejected, function (state, action) {
903
+ state.loading = false;
904
+ var error = action.error.message;
905
+ if (error !== 'Aborted') {
906
+ state.error = error;
907
+ }
693
908
  })
694
909
  .addCase(updateLeadIdentity.pending, function (state) {
695
910
  state.loading = true;
@@ -738,7 +953,7 @@ export var businessSlice = createSlice({
738
953
  state.loading = true;
739
954
  })
740
955
  .addCase(retrieveEntityList.fulfilled, function (state, action) {
741
- var _a, _b, _c, _d, _e, _f, _g;
956
+ var _a, _b, _c, _d;
742
957
  state.error = null;
743
958
  state.loading = false;
744
959
  var data = action.payload;
@@ -760,15 +975,11 @@ export var businessSlice = createSlice({
760
975
  }
761
976
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
762
977
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: licenseList });
763
- var licenseNumber = (((_c = (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) || {}).number;
764
- var selectedLicense = ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
765
- var license = _a.license;
766
- return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber;
767
- })) || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
978
+ var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
979
+ var isOtherLicense = ((_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.number) === 'other_fl' || ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_cr';
768
980
  state.data.businessTypeData.selectedLicense = selectedLicense;
769
- var isOtherLicense = ((_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number) === 'other_fl' || ((_f = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _f === void 0 ? void 0 : _f.number) === 'other_cr';
770
981
  if (!isOtherLicense)
771
- state.data.businessTypeData.licenseNumber = ((_g = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _g === void 0 ? void 0 : _g.number) || '';
982
+ state.data.businessTypeData.licenseNumber = ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) || '';
772
983
  })
773
984
  .addCase(retrieveEntityList.rejected, function (state, action) {
774
985
  state.error = action.error.message;
@@ -787,30 +998,6 @@ export var businessSlice = createSlice({
787
998
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
788
999
  state.error = action.error.message;
789
1000
  state.loading = false;
790
- })
791
- .addCase(retrieveChannels.pending, function (state) {
792
- state.error = null;
793
- state.loading = true;
794
- })
795
- .addCase(retrieveChannels.fulfilled, function (state, action) {
796
- var _a;
797
- state.error = null;
798
- state.loading = false;
799
- var data = action.payload || {};
800
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
801
- if (description) {
802
- state.error = description;
803
- return;
804
- }
805
- var channels = data || [];
806
- state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { channelList: channels });
807
- var selectedChannel = channels === null || channels === void 0 ? void 0 : channels[0];
808
- if (!!selectedChannel)
809
- state.data.activitiesData.salesChannels = [selectedChannel];
810
- })
811
- .addCase(retrieveChannels.rejected, function (state, action) {
812
- state.error = action.error.message;
813
- state.loading = false;
814
1001
  })
815
1002
  .addCase(updateLeadBusinessType.pending, function (state) {
816
1003
  state.loading = true;
@@ -820,7 +1007,7 @@ export var businessSlice = createSlice({
820
1007
  var _a;
821
1008
  state.loading = false;
822
1009
  state.error = null;
823
- var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData;
1010
+ var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData, documentData = _b.documentData;
824
1011
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
825
1012
  var entity = data.entity, entity_activities = data.entity_activities;
826
1013
  var issuingDate = (_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date;
@@ -836,12 +1023,26 @@ export var businessSlice = createSlice({
836
1023
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
837
1024
  if (!!selectedActivity)
838
1025
  state.data.activitiesData.activities = [selectedActivity];
839
- state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData);
1026
+ state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
840
1027
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: entity });
841
1028
  })
842
1029
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
843
1030
  state.loading = false;
844
1031
  state.error = action.error.message;
1032
+ })
1033
+ .addCase(uploadLicenseCertificate.pending, function (state) {
1034
+ state.error = null;
1035
+ state.uploading = true;
1036
+ })
1037
+ .addCase(uploadLicenseCertificate.fulfilled, function (state, action) {
1038
+ state.error = null;
1039
+ state.uploading = false;
1040
+ var data = action.payload.data;
1041
+ state.data.businessTypeData.certificateId = data === null || data === void 0 ? void 0 : data.id;
1042
+ })
1043
+ .addCase(uploadLicenseCertificate.rejected, function (state) {
1044
+ state.uploading = false;
1045
+ state.error = 'file_upload_error';
845
1046
  })
846
1047
  .addCase(updateActivitiesInfo.pending, function (state) {
847
1048
  state.loading = true;
@@ -866,19 +1067,19 @@ export var businessSlice = createSlice({
866
1067
  state.error = null;
867
1068
  })
868
1069
  .addCase(retrieveDataList.fulfilled, function (state, action) {
869
- var _a, _b;
1070
+ var _a, _b, _c, _d, _e;
870
1071
  state.loading = false;
871
1072
  state.error = null;
872
1073
  var payload = action.payload;
873
- var customerBases = payload.customerBases || [];
1074
+ var customerBases = ((_a = payload.customerBases) === null || _a === void 0 ? void 0 : _a.list) || [];
874
1075
  var customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[1];
875
- var expectedSales = payload.expectedSales || [];
876
- var expectedSale = (_b = (_a = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[0]) === null || _a === void 0 ? void 0 : _a.sub) === null || _b === void 0 ? void 0 : _b[4];
877
- var expectedCustomerSales = payload.expectedCustomerSales || [];
1076
+ var expectedSales = ((_b = payload.expectedSales) === null || _b === void 0 ? void 0 : _b.list) || [];
1077
+ var expectedSale = (_d = (_c = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[0]) === null || _c === void 0 ? void 0 : _c.sub) === null || _d === void 0 ? void 0 : _d[4];
1078
+ var expectedCustomerSales = ((_e = payload.expectedCustomerSales) === null || _e === void 0 ? void 0 : _e.list) || [];
878
1079
  var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
879
1080
  state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
880
1081
  if (!!customerBase)
881
- state.data.customersData.customerLocations = [customerBase];
1082
+ state.data.customersData.customerLocations = [customerBase, customerBases[0]];
882
1083
  if (!!expectedSale)
883
1084
  state.data.customersData.expectedSale = expectedSale;
884
1085
  if (!!expectedCustomerSale)
@@ -904,7 +1105,7 @@ export var businessSlice = createSlice({
904
1105
  state.error = action.error.message;
905
1106
  })
906
1107
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
907
- var _a;
1108
+ var _a, _b;
908
1109
  state.loading = false;
909
1110
  state.error = null;
910
1111
  var response = (action.payload || {}).response;
@@ -913,7 +1114,7 @@ export var businessSlice = createSlice({
913
1114
  state.error = description;
914
1115
  return;
915
1116
  }
916
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), response);
1117
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), response), { name: (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.name });
917
1118
  })
918
1119
  .addCase(updateLeadSuccess.pending, function (state) {
919
1120
  state.loading = true;