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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/build/@types/app.d.ts +57 -20
  2. package/build/@types/app.js +14 -1
  3. package/build/@types/form.d.ts +17 -10
  4. package/build/api/auth.d.ts +24 -2
  5. package/build/api/auth.js +36 -1
  6. package/build/api/axios.js +2 -2
  7. package/build/api/brand.d.ts +2 -1
  8. package/build/api/brand.js +10 -1
  9. package/build/api/country.d.ts +3 -1
  10. package/build/api/country.js +3 -1
  11. package/build/api/data.d.ts +38 -7
  12. package/build/api/data.js +57 -17
  13. package/build/api/entity.d.ts +28 -5
  14. package/build/api/entity.js +23 -9
  15. package/build/api/firebase.d.ts +1 -1
  16. package/build/api/firebase.js +3 -1
  17. package/build/api/index.d.ts +41 -14
  18. package/build/api/individual.d.ts +76 -19
  19. package/build/api/individual.js +29 -2
  20. package/build/api/lead.d.ts +8 -6
  21. package/build/app/rootReducer.d.ts +1 -1
  22. package/build/app/rootReducer.js +2 -2
  23. package/build/app/settings.d.ts +8 -2
  24. package/build/app/settings.js +29 -12
  25. package/build/app/store.d.ts +3 -3
  26. package/build/assets/locales/ar.json +256 -179
  27. package/build/assets/locales/en.json +188 -104
  28. package/build/components/AnimationFlow/AnimationFlow.d.ts +5 -1
  29. package/build/components/AnimationFlow/AnimationFlow.js +6 -8
  30. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  31. package/build/components/AnimationFlow/BottomSheet.js +4 -3
  32. package/build/components/AnimationFlow/Dialog.d.ts +5 -1
  33. package/build/components/AnimationFlow/Dialog.js +11 -5
  34. package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
  35. package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
  36. package/build/components/ArabicDatePicker/index.d.ts +2 -0
  37. package/build/components/ArabicDatePicker/index.js +2 -0
  38. package/build/components/ArabicDatePicker/style.css +24 -0
  39. package/build/components/FileInput/DragAndDrop.d.ts +10 -1
  40. package/build/components/FileInput/DragAndDrop.js +107 -8
  41. package/build/components/Lottie/Lottie.d.ts +878 -0
  42. package/build/components/Lottie/Lottie.js +58 -0
  43. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  44. package/build/components/Lottie/files/success.json +425 -0
  45. package/build/components/Lottie/index.d.ts +3 -0
  46. package/build/components/Lottie/index.js +3 -0
  47. package/build/components/OTPField/OTPField.d.ts +2 -1
  48. package/build/components/OTPField/OTPField.js +2 -2
  49. package/build/components/OTPTimer/OTPTimer.js +1 -1
  50. package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
  51. package/build/components/ProgressBar/CircularProgressBar.js +48 -0
  52. package/build/components/ProgressBar/index.d.ts +2 -0
  53. package/build/components/ProgressBar/index.js +2 -0
  54. package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
  55. package/build/components/RadioLabel/RadioLabel.js +2 -2
  56. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +1 -4
  57. package/build/components/SocialMediaGroup/SocialMediaGroup.js +3 -55
  58. package/build/constants/api.d.ts +6 -0
  59. package/build/constants/api.js +14 -1
  60. package/build/constants/app.d.ts +7 -5
  61. package/build/constants/app.js +55 -22
  62. package/build/constants/assets.d.ts +20 -1
  63. package/build/constants/assets.js +27 -8
  64. package/build/constants/dummy.d.ts +1 -1
  65. package/build/constants/dummy.js +2 -2
  66. package/build/constants/validation.d.ts +8 -0
  67. package/build/constants/validation.js +9 -1
  68. package/build/features/app/auth/authStore.d.ts +47 -0
  69. package/build/features/app/auth/authStore.js +265 -0
  70. package/build/features/app/bank/bankStore.d.ts +16 -0
  71. package/build/features/app/bank/bankStore.js +81 -37
  72. package/build/features/app/business/businessStore.d.ts +22 -3
  73. package/build/features/app/business/businessStore.js +430 -290
  74. package/build/features/app/connect/connectStore.d.ts +33 -30
  75. package/build/features/app/connect/connectStore.js +398 -258
  76. package/build/features/app/entity/entityStore.d.ts +5 -0
  77. package/build/features/app/entity/entityStore.js +153 -14
  78. package/build/features/app/individual/individualStore.d.ts +17 -0
  79. package/build/features/app/individual/individualStore.js +167 -83
  80. package/build/features/app/password/passwordStore.js +1 -1
  81. package/build/features/app/tax/taxStore.js +3 -2
  82. package/build/features/auth/Auth.d.ts +10 -0
  83. package/build/features/auth/Auth.js +87 -0
  84. package/build/features/auth/index.d.ts +1 -0
  85. package/build/features/auth/index.js +1 -0
  86. package/build/features/auth/screens/NID/DOB.d.ts +7 -0
  87. package/build/features/auth/screens/NID/DOB.js +47 -0
  88. package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
  89. package/build/features/auth/screens/NID/IDNumber.js +64 -0
  90. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  91. package/build/features/auth/screens/NID/NID.js +67 -0
  92. package/build/features/auth/screens/NID/TAC.d.ts +3 -0
  93. package/build/features/auth/screens/NID/TAC.js +87 -0
  94. package/build/features/auth/screens/NID/index.d.ts +3 -0
  95. package/build/features/auth/screens/NID/index.js +2 -0
  96. package/build/features/auth/screens/NID/validation.d.ts +27 -0
  97. package/build/features/auth/screens/NID/validation.js +19 -0
  98. package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
  99. package/build/features/auth/screens/OTP/OTP.js +76 -0
  100. package/build/features/{otp/screens/OTPVerify/Verify.d.ts → auth/screens/OTP/OTPInput.d.ts} +0 -0
  101. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/OTPInput.js +11 -7
  102. package/build/features/auth/screens/OTP/index.d.ts +3 -0
  103. package/build/features/auth/screens/OTP/index.js +2 -0
  104. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.d.ts +0 -0
  105. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.js +0 -0
  106. package/build/features/bank/Bank.js +12 -6
  107. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
  108. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  109. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  110. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  111. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  112. package/build/features/business/Business.d.ts +1 -1
  113. package/build/features/business/Business.js +14 -7
  114. package/build/features/business/screens/Activities/Activities.js +1 -6
  115. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  116. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  117. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  118. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  119. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  120. package/build/features/business/screens/Activities/validation.js +0 -9
  121. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  122. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  123. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  124. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  125. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  126. package/build/features/business/screens/BusinessType/LicenseList.js +24 -7
  127. package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
  128. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  129. package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
  130. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  131. package/build/features/business/screens/BusinessType/validation.js +50 -1
  132. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  133. package/build/features/business/screens/CivilID/CivilID.js +84 -0
  134. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  135. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  136. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  137. package/build/features/business/screens/CivilID/index.js +2 -0
  138. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  139. package/build/features/business/screens/CivilID/validation.js +4 -0
  140. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  141. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  142. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  143. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  144. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  145. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  146. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -7
  147. package/build/features/business/screens/Verify/Verify.js +4 -4
  148. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  149. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +157 -0
  150. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
  151. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +22 -0
  152. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  153. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  154. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  155. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  156. package/build/features/connect/Connect.d.ts +2 -1
  157. package/build/features/connect/Connect.js +47 -12
  158. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  159. package/build/features/connect/screens/CivilID/CivilID.js +98 -0
  160. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  161. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  162. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  163. package/build/features/connect/screens/CivilID/index.js +2 -0
  164. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  165. package/build/features/connect/screens/CivilID/validation.js +4 -0
  166. package/build/features/connect/screens/Individual/Email.js +11 -3
  167. package/build/features/connect/screens/Individual/Individual.js +27 -14
  168. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  169. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  170. package/build/features/connect/screens/Merchant/Merchant.js +47 -50
  171. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +7 -0
  172. package/build/features/connect/screens/Merchant/SalesChannels.js +113 -0
  173. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  174. package/build/features/connect/screens/Merchant/SocialMedia.js +131 -66
  175. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  176. package/build/features/connect/screens/Merchant/validation.d.ts +22 -45
  177. package/build/features/connect/screens/Merchant/validation.js +117 -116
  178. package/build/features/connect/screens/Mobile/Mobile.js +31 -10
  179. package/build/features/connect/screens/NID/NID.js +2 -1
  180. package/build/features/connect/screens/OTP/OTP.js +5 -4
  181. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  182. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  183. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  184. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
  185. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +22 -0
  186. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  187. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  188. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  189. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  190. package/build/features/entity/Entity.d.ts +1 -1
  191. package/build/features/entity/Entity.js +16 -9
  192. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
  193. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +140 -0
  194. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +52 -2
  195. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
  196. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
  197. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
  198. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
  199. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
  200. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
  201. package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.d.ts +0 -0
  202. package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.js +8 -5
  203. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
  204. package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
  205. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
  206. package/build/features/featuresScreens.d.ts +1 -1
  207. package/build/features/featuresScreens.js +31 -6
  208. package/build/features/individual/Individual.d.ts +1 -1
  209. package/build/features/individual/Individual.js +14 -7
  210. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
  211. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  212. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  213. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  214. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  215. package/build/features/individual/screens/Verify/Verify.js +4 -4
  216. package/build/features/password/Password.d.ts +1 -1
  217. package/build/features/password/Password.js +14 -7
  218. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -9
  219. package/build/features/shared/Background/Background.d.ts +6 -5
  220. package/build/features/shared/Background/Background.js +16 -5
  221. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  222. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  223. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  224. package/build/features/shared/Button/MobileButton.js +2 -2
  225. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  226. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  227. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  228. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  229. package/build/features/shared/Dialog/index.d.ts +4 -0
  230. package/build/features/shared/Dialog/index.js +4 -0
  231. package/build/features/shared/Input/Input.d.ts +1 -1
  232. package/build/features/shared/Input/Input.js +2 -2
  233. package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
  234. package/build/features/shared/UploadFile/UploadFile.d.ts +9 -3
  235. package/build/features/shared/UploadFile/UploadFile.js +23 -8
  236. package/build/features/signIn/SignIn.d.ts +1 -1
  237. package/build/features/signIn/SignIn.js +14 -6
  238. package/build/features/tax/Tax.d.ts +1 -1
  239. package/build/features/tax/Tax.js +16 -8
  240. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -7
  241. package/build/hooks/index.d.ts +1 -0
  242. package/build/hooks/index.js +1 -0
  243. package/build/hooks/useAppConfig.d.ts +3 -1
  244. package/build/hooks/useAppConfig.js +4 -2
  245. package/build/hooks/useAppDispatch.d.ts +1 -1
  246. package/build/hooks/useErrorListener.js +0 -5
  247. package/build/hooks/useScreen.d.ts +3 -0
  248. package/build/hooks/useScreen.js +14 -0
  249. package/build/index.d.ts +3 -3
  250. package/build/index.js +5 -5
  251. package/build/utils/array.d.ts +13 -1
  252. package/build/utils/array.js +26 -0
  253. package/build/utils/common.d.ts +1 -0
  254. package/build/utils/common.js +3 -0
  255. package/build/utils/device.d.ts +1 -0
  256. package/build/utils/device.js +13 -0
  257. package/build/utils/html.d.ts +1 -0
  258. package/build/utils/html.js +6 -0
  259. package/build/utils/index.d.ts +1 -0
  260. package/build/utils/index.js +1 -0
  261. package/build/utils/locale.js +1 -1
  262. package/build/utils/object.d.ts +1 -0
  263. package/build/utils/object.js +12 -0
  264. package/build/utils/rsa.d.ts +2 -2
  265. package/build/utils/rsa.js +1 -1
  266. package/build/utils/string.d.ts +33 -20
  267. package/build/utils/string.js +71 -1
  268. package/build/utils/validation.d.ts +2 -0
  269. package/build/utils/validation.js +6 -0
  270. package/package.json +129 -128
  271. package/build/features/app/otp/otpStore.d.ts +0 -28
  272. package/build/features/app/otp/otpStore.js +0 -153
  273. package/build/features/otp/OTP.d.ts +0 -7
  274. package/build/features/otp/OTP.js +0 -55
  275. package/build/features/otp/index.d.ts +0 -0
  276. package/build/features/otp/index.js +0 -1
  277. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  278. package/build/features/otp/screens/OTPVerify/Verify.js +0 -50
  279. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  280. package/build/features/otp/screens/OTPVerify/index.js +0 -2
@@ -60,13 +60,13 @@ import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType, FlowsTypes } from '../../../@types';
62
62
  import { BUSINESS_FLOW_SUCCESS, 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';
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
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,7 +655,9 @@ 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());
@@ -517,7 +677,7 @@ export var updateStepName = createAsyncThunk('updateStepName', function (stepNam
517
677
  business = thunkApi.getState().business;
518
678
  payload = {
519
679
  step_name: stepName,
520
- 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) || '',
521
681
  encryption_contract: []
522
682
  };
523
683
  return [4, API.leadService.updateLead(payload)];
@@ -531,6 +691,7 @@ var initialState = {
531
691
  error: null,
532
692
  loading: false,
533
693
  customLoading: false,
694
+ uploading: false,
534
695
  data: {
535
696
  flowName: FlowsTypes.BUSINESS,
536
697
  verify: {
@@ -540,18 +701,22 @@ var initialState = {
540
701
  otp: '',
541
702
  isNID: false
542
703
  },
704
+ civilIdData: {
705
+ civilId: ''
706
+ },
543
707
  nidData: {
544
708
  nid: '',
545
709
  dob: getEighteenYearsAgo(),
546
710
  type: ''
547
711
  },
548
712
  businessTypeData: {
549
- licenseNumber: ''
713
+ licenseNumber: '',
714
+ entityLegalName: '',
715
+ uploading: false
550
716
  },
551
717
  activitiesData: {
552
718
  activities: [],
553
- salesChannels: [],
554
- operationStartDate: '1998-08-22'
719
+ operationStartDate: new Date().toString()
555
720
  },
556
721
  customersData: {
557
722
  customerLocations: [],
@@ -583,19 +748,19 @@ export var businessSlice = createSlice({
583
748
  state.customLoading = true;
584
749
  })
585
750
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
586
- var _a, _b, _c, _d, _e, _f;
751
+ var _a, _b, _c, _d;
587
752
  state.error = null;
588
753
  state.customLoading = false;
589
- var _g = action.payload, data = _g.data, token = _g.token, leadData = _g.leadData, brandInfo = _g.brandInfo, boardId = _g.boardId;
754
+ var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo, boardId = _e.boardId;
590
755
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
591
756
  if (description) {
592
757
  state.error = description;
593
758
  return;
594
759
  }
595
- 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 });
596
761
  state.data.verify.token = token;
597
762
  state.data.otpData.isNID = false;
598
- var _h = state.data.verify.responseBody || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_type = _h.business_type, brand = _h.brand;
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;
599
764
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
600
765
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
601
766
  : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
@@ -603,47 +768,27 @@ export var businessSlice = createSlice({
603
768
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
604
769
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
605
770
  }
606
- var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
607
- var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
608
- var _j = brand || {}, website = _j.website, social = _j.social;
609
- var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
610
- var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
611
- var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
612
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
613
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
614
- if (isHasWebsite && (isHasTwitter || isHasInstagram))
615
- selectedChannels = [websiteData, socialData];
616
- else if (isHasTwitter || isHasInstagram)
617
- selectedChannels = [socialData];
618
- else if (isHasWebsite)
619
- selectedChannels = [websiteData];
620
- if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
621
- selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
622
- var _a;
623
- 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(); });
624
- });
625
- }
626
- state.data.activitiesData.salesChannels = selectedChannels;
627
771
  var activities = entity_activities || [];
628
772
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
629
773
  var _a;
630
- 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; });
631
775
  });
632
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]];
633
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) || '';
634
779
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
635
- var licenseNumber_1 = (_e = entity === null || entity === void 0 ? void 0 : entity.license) === null || _e === void 0 ? void 0 : _e.number;
636
- var _k = state.data.businessTypeData || {}, responseBody = _k.responseBody, selectedLicense = _k.selectedLicense;
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;
637
782
  var licenseList = (responseBody || {}).licenseList;
638
783
  var selectedLicenseData = selectedLicense;
639
784
  if (!!licenseNumber_1) {
640
785
  selectedLicenseData =
641
- ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
786
+ ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
642
787
  var license = _a.license;
643
788
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_1;
644
789
  })) ||
645
- business_type === BusinessType.CR
646
- ? __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } });
790
+ business_type === BusinessType.FL
791
+ ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } });
647
792
  state.data.businessTypeData.licenseNumber = licenseNumber_1 || '';
648
793
  }
649
794
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
@@ -675,10 +820,10 @@ export var businessSlice = createSlice({
675
820
  state.error = null;
676
821
  })
677
822
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
678
- var _a, _b, _c, _d, _e, _f;
823
+ var _a, _b, _c, _d, _e;
679
824
  state.loading = false;
680
825
  state.error = null;
681
- var _g = action.payload, data = _g.data, formData = _g.formData, brandInfo = _g.brandInfo;
826
+ var _f = action.payload, data = _f.data, formData = _f.formData, brandInfo = _f.brandInfo, leadData = _f.leadData;
682
827
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
683
828
  if (description) {
684
829
  state.error = description;
@@ -686,55 +831,36 @@ export var businessSlice = createSlice({
686
831
  }
687
832
  state.data.otpData = formData;
688
833
  state.data.otpData.responseBody = data;
689
- var _h = state.data.verify.responseBody || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_type = _h.business_type, brand = _h.brand;
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;
690
836
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
691
837
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
692
- : (_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;
693
839
  if (!!issuingDate) {
694
840
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
695
841
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
696
842
  }
697
- var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
698
- var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
699
- var _j = brand || {}, website = _j.website, social = _j.social;
700
- var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
701
- var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
702
- var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
703
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
704
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
705
- if (isHasWebsite && (isHasTwitter || isHasInstagram))
706
- selectedChannels = [websiteData, socialData];
707
- else if (isHasTwitter || isHasInstagram)
708
- selectedChannels = [socialData];
709
- else if (isHasWebsite)
710
- selectedChannels = [websiteData];
711
- if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
712
- selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
713
- var _a;
714
- 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(); });
715
- });
716
- }
717
- state.data.activitiesData.salesChannels = selectedChannels;
718
843
  var activities = entity_activities || [];
719
844
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
720
845
  var _a;
721
- 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; });
722
847
  });
723
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]];
724
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) || '';
725
851
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
726
- var licenseNumber_2 = (_e = entity === null || entity === void 0 ? void 0 : entity.license) === null || _e === void 0 ? void 0 : _e.number;
727
- var _k = state.data.businessTypeData || {}, responseBody = _k.responseBody, selectedLicense = _k.selectedLicense;
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;
728
854
  var licenseList = (responseBody || {}).licenseList;
729
855
  var selectedLicenseData = selectedLicense;
730
856
  if (!!licenseNumber_2) {
731
857
  selectedLicenseData =
732
- ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
858
+ ((_e = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _e === void 0 ? void 0 : _e.call(licenseList, function (_a) {
733
859
  var license = _a.license;
734
860
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
735
861
  })) ||
736
- business_type === BusinessType.CR
737
- ? __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } });
862
+ business_type === BusinessType.FL
863
+ ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } });
738
864
  state.data.businessTypeData.licenseNumber = licenseNumber_2 || '';
739
865
  }
740
866
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
@@ -743,6 +869,42 @@ export var businessSlice = createSlice({
743
869
  .addCase(verifyLeadOTP.rejected, function (state, action) {
744
870
  state.loading = false;
745
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
+ }
746
908
  })
747
909
  .addCase(updateLeadIdentity.pending, function (state) {
748
910
  state.loading = true;
@@ -836,42 +998,6 @@ export var businessSlice = createSlice({
836
998
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
837
999
  state.error = action.error.message;
838
1000
  state.loading = false;
839
- })
840
- .addCase(retrieveChannels.pending, function (state) {
841
- state.error = null;
842
- state.loading = true;
843
- })
844
- .addCase(retrieveChannels.fulfilled, function (state, action) {
845
- var _a;
846
- state.error = null;
847
- state.loading = false;
848
- var data = action.payload || {};
849
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
850
- if (description) {
851
- state.error = description;
852
- return;
853
- }
854
- var channels = data || [];
855
- state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { channelList: channels });
856
- var brand = (state.data.verify.responseBody || {}).brand;
857
- var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
858
- var _b = brand || {}, website = _b.website, social = _b.social;
859
- var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
860
- var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
861
- var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
862
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
863
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
864
- if (isHasWebsite && (isHasTwitter || isHasInstagram))
865
- selectedChannels = [websiteData, socialData];
866
- else if (isHasTwitter || isHasInstagram)
867
- selectedChannels = [socialData];
868
- else if (isHasWebsite)
869
- selectedChannels = [websiteData];
870
- state.data.activitiesData.salesChannels = selectedChannels;
871
- })
872
- .addCase(retrieveChannels.rejected, function (state, action) {
873
- state.error = action.error.message;
874
- state.loading = false;
875
1001
  })
876
1002
  .addCase(updateLeadBusinessType.pending, function (state) {
877
1003
  state.loading = true;
@@ -881,7 +1007,7 @@ export var businessSlice = createSlice({
881
1007
  var _a;
882
1008
  state.loading = false;
883
1009
  state.error = null;
884
- 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;
885
1011
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
886
1012
  var entity = data.entity, entity_activities = data.entity_activities;
887
1013
  var issuingDate = (_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date;
@@ -897,12 +1023,26 @@ export var businessSlice = createSlice({
897
1023
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
898
1024
  if (!!selectedActivity)
899
1025
  state.data.activitiesData.activities = [selectedActivity];
900
- 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);
901
1027
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: entity });
902
1028
  })
903
1029
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
904
1030
  state.loading = false;
905
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';
906
1046
  })
907
1047
  .addCase(updateActivitiesInfo.pending, function (state) {
908
1048
  state.loading = true;
@@ -927,19 +1067,19 @@ export var businessSlice = createSlice({
927
1067
  state.error = null;
928
1068
  })
929
1069
  .addCase(retrieveDataList.fulfilled, function (state, action) {
930
- var _a, _b;
1070
+ var _a, _b, _c, _d, _e;
931
1071
  state.loading = false;
932
1072
  state.error = null;
933
1073
  var payload = action.payload;
934
- var customerBases = payload.customerBases || [];
1074
+ var customerBases = ((_a = payload.customerBases) === null || _a === void 0 ? void 0 : _a.list) || [];
935
1075
  var customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[1];
936
- var expectedSales = payload.expectedSales || [];
937
- 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];
938
- 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) || [];
939
1079
  var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
940
1080
  state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
941
1081
  if (!!customerBase)
942
- state.data.customersData.customerLocations = [customerBase];
1082
+ state.data.customersData.customerLocations = [customerBase, customerBases[0]];
943
1083
  if (!!expectedSale)
944
1084
  state.data.customersData.expectedSale = expectedSale;
945
1085
  if (!!expectedCustomerSale)
@@ -965,7 +1105,7 @@ export var businessSlice = createSlice({
965
1105
  state.error = action.error.message;
966
1106
  })
967
1107
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
968
- var _a;
1108
+ var _a, _b;
969
1109
  state.loading = false;
970
1110
  state.error = null;
971
1111
  var response = (action.payload || {}).response;
@@ -974,7 +1114,7 @@ export var businessSlice = createSlice({
974
1114
  state.error = description;
975
1115
  return;
976
1116
  }
977
- 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 });
978
1118
  })
979
1119
  .addCase(updateLeadSuccess.pending, function (state) {
980
1120
  state.loading = true;