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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/build/@types/app.d.ts +52 -21
  2. package/build/@types/app.js +10 -3
  3. package/build/@types/form.d.ts +18 -10
  4. package/build/api/auth.d.ts +24 -2
  5. package/build/api/auth.js +36 -1
  6. package/build/api/axios.js +2 -2
  7. package/build/api/brand.d.ts +2 -1
  8. package/build/api/brand.js +10 -1
  9. package/build/api/country.d.ts +3 -1
  10. package/build/api/country.js +3 -1
  11. package/build/api/data.d.ts +38 -7
  12. package/build/api/data.js +57 -17
  13. package/build/api/entity.d.ts +53 -5
  14. package/build/api/entity.js +39 -9
  15. package/build/api/firebase.d.ts +1 -1
  16. package/build/api/firebase.js +3 -1
  17. package/build/api/index.d.ts +44 -14
  18. package/build/api/individual.d.ts +76 -19
  19. package/build/api/individual.js +29 -2
  20. package/build/api/lead.d.ts +9 -6
  21. package/build/api/lead.js +8 -1
  22. package/build/app/rootReducer.d.ts +1 -1
  23. package/build/app/rootReducer.js +2 -2
  24. package/build/app/settings.d.ts +8 -2
  25. package/build/app/settings.js +29 -12
  26. package/build/app/store.d.ts +3 -3
  27. package/build/assets/locales/ar.json +258 -183
  28. package/build/assets/locales/en.json +190 -108
  29. package/build/components/AnimationFlow/AnimationFlow.d.ts +5 -1
  30. package/build/components/AnimationFlow/AnimationFlow.js +6 -8
  31. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  32. package/build/components/AnimationFlow/BottomSheet.js +4 -3
  33. package/build/components/AnimationFlow/Dialog.d.ts +5 -1
  34. package/build/components/AnimationFlow/Dialog.js +11 -5
  35. package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
  36. package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
  37. package/build/components/ArabicDatePicker/index.d.ts +2 -0
  38. package/build/components/ArabicDatePicker/index.js +2 -0
  39. package/build/components/ArabicDatePicker/style.css +24 -0
  40. package/build/components/FileInput/DragAndDrop.d.ts +10 -1
  41. package/build/components/FileInput/DragAndDrop.js +108 -8
  42. package/build/components/Lottie/Lottie.d.ts +878 -0
  43. package/build/components/Lottie/Lottie.js +58 -0
  44. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  45. package/build/components/Lottie/files/success.json +425 -0
  46. package/build/components/Lottie/index.d.ts +3 -0
  47. package/build/components/Lottie/index.js +3 -0
  48. package/build/components/OTPField/OTPField.d.ts +2 -1
  49. package/build/components/OTPField/OTPField.js +2 -2
  50. package/build/components/OTPTimer/OTPTimer.js +1 -1
  51. package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
  52. package/build/components/ProgressBar/CircularProgressBar.js +48 -0
  53. package/build/components/ProgressBar/index.d.ts +2 -0
  54. package/build/components/ProgressBar/index.js +2 -0
  55. package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
  56. package/build/components/RadioLabel/RadioLabel.js +2 -2
  57. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -6
  58. package/build/components/SocialMediaGroup/SocialMediaGroup.js +4 -49
  59. package/build/constants/api.d.ts +6 -0
  60. package/build/constants/api.js +14 -1
  61. package/build/constants/app.d.ts +7 -5
  62. package/build/constants/app.js +56 -23
  63. package/build/constants/assets.d.ts +14 -0
  64. package/build/constants/assets.js +16 -2
  65. package/build/constants/dummy.d.ts +1 -1
  66. package/build/constants/dummy.js +2 -2
  67. package/build/constants/validation.d.ts +8 -0
  68. package/build/constants/validation.js +9 -1
  69. package/build/features/app/auth/authStore.d.ts +47 -0
  70. package/build/features/app/auth/authStore.js +260 -0
  71. package/build/features/app/bank/bankStore.d.ts +16 -0
  72. package/build/features/app/bank/bankStore.js +86 -39
  73. package/build/features/app/business/businessStore.d.ts +22 -3
  74. package/build/features/app/business/businessStore.js +432 -291
  75. package/build/features/app/connect/connectStore.d.ts +33 -31
  76. package/build/features/app/connect/connectStore.js +394 -308
  77. package/build/features/app/entity/entityStore.d.ts +30 -5
  78. package/build/features/app/entity/entityStore.js +258 -47
  79. package/build/features/app/individual/individualStore.d.ts +17 -0
  80. package/build/features/app/individual/individualStore.js +170 -84
  81. package/build/features/app/password/passwordStore.js +1 -1
  82. package/build/features/app/tax/taxStore.js +18 -14
  83. package/build/features/auth/Auth.d.ts +10 -0
  84. package/build/features/auth/Auth.js +87 -0
  85. package/build/features/auth/index.d.ts +1 -0
  86. package/build/features/auth/index.js +1 -0
  87. package/build/features/auth/screens/NID/DOB.d.ts +7 -0
  88. package/build/features/auth/screens/NID/DOB.js +47 -0
  89. package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
  90. package/build/features/auth/screens/NID/IDNumber.js +64 -0
  91. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  92. package/build/features/auth/screens/NID/NID.js +68 -0
  93. package/build/features/auth/screens/NID/TAC.d.ts +3 -0
  94. package/build/features/auth/screens/NID/TAC.js +87 -0
  95. package/build/features/auth/screens/NID/index.d.ts +3 -0
  96. package/build/features/auth/screens/NID/index.js +2 -0
  97. package/build/features/auth/screens/NID/validation.d.ts +27 -0
  98. package/build/features/auth/screens/NID/validation.js +19 -0
  99. package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
  100. package/build/features/auth/screens/OTP/OTP.js +76 -0
  101. package/build/features/{otp/screens/OTPVerify/Verify.d.ts → auth/screens/OTP/OTPInput.d.ts} +0 -0
  102. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/OTPInput.js +11 -7
  103. package/build/features/auth/screens/OTP/index.d.ts +3 -0
  104. package/build/features/auth/screens/OTP/index.js +2 -0
  105. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.d.ts +0 -0
  106. package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.js +0 -0
  107. package/build/features/bank/Bank.js +12 -6
  108. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
  109. package/build/features/bank/screens/BankDetails/BankName.js +2 -1
  110. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  111. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  112. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  113. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  114. package/build/features/business/Business.d.ts +1 -1
  115. package/build/features/business/Business.js +14 -7
  116. package/build/features/business/screens/Activities/Activities.js +16 -17
  117. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  118. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  119. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  120. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  121. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  122. package/build/features/business/screens/Activities/validation.js +0 -9
  123. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  124. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  125. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  126. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  127. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  128. package/build/features/business/screens/BusinessType/LicenseList.js +24 -7
  129. package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
  130. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  131. package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
  132. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  133. package/build/features/business/screens/BusinessType/validation.js +50 -1
  134. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  135. package/build/features/business/screens/CivilID/CivilID.js +67 -0
  136. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  137. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  138. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  139. package/build/features/business/screens/CivilID/index.js +2 -0
  140. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  141. package/build/features/business/screens/CivilID/validation.js +4 -0
  142. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  143. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  144. package/build/features/business/screens/Customers/Customers.js +15 -9
  145. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  146. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  147. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  148. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  149. package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
  150. package/build/features/business/screens/OTP/OTP.js +15 -2
  151. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -7
  152. package/build/features/business/screens/Verify/Verify.js +4 -4
  153. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  154. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
  155. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  156. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  157. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  158. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  159. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  160. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  161. package/build/features/connect/Connect.d.ts +2 -1
  162. package/build/features/connect/Connect.js +47 -12
  163. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  164. package/build/features/connect/screens/CivilID/CivilID.js +99 -0
  165. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  166. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  167. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  168. package/build/features/connect/screens/CivilID/index.js +2 -0
  169. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  170. package/build/features/connect/screens/CivilID/validation.js +4 -0
  171. package/build/features/connect/screens/Individual/Email.js +11 -3
  172. package/build/features/connect/screens/Individual/Individual.js +41 -27
  173. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  174. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  175. package/build/features/connect/screens/Merchant/Merchant.js +41 -64
  176. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
  177. package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
  178. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  179. package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
  180. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  181. package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
  182. package/build/features/connect/screens/Merchant/validation.js +108 -173
  183. package/build/features/connect/screens/Mobile/Mobile.js +30 -12
  184. package/build/features/connect/screens/NID/NID.js +2 -1
  185. package/build/features/connect/screens/OTP/OTP.js +20 -6
  186. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  187. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  188. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  189. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  190. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  191. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  192. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  193. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  194. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  195. package/build/features/entity/Entity.d.ts +1 -1
  196. package/build/features/entity/Entity.js +16 -9
  197. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +55 -0
  198. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +149 -0
  199. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
  200. package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
  201. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +71 -2
  202. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
  203. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +32 -0
  204. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
  205. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +49 -0
  206. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
  207. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +33 -0
  208. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +68 -0
  209. package/build/features/entity/screens/EntityInfoConfirm/validation.js +24 -0
  210. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
  211. package/build/features/entity/screens/Verify/Verify.js +18 -5
  212. package/build/features/featuresScreens.d.ts +1 -1
  213. package/build/features/featuresScreens.js +31 -6
  214. package/build/features/individual/Individual.d.ts +1 -1
  215. package/build/features/individual/Individual.js +14 -7
  216. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
  217. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  218. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  219. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  220. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  221. package/build/features/individual/screens/Verify/Verify.js +18 -5
  222. package/build/features/password/Password.d.ts +1 -1
  223. package/build/features/password/Password.js +14 -7
  224. package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
  225. package/build/features/password/screens/OTP/OTP.js +15 -2
  226. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -9
  227. package/build/features/password/screens/Verify/Verify.js +16 -3
  228. package/build/features/shared/Background/Background.d.ts +6 -5
  229. package/build/features/shared/Background/Background.js +16 -5
  230. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  231. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  232. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  233. package/build/features/shared/Button/MobileButton.js +2 -2
  234. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  235. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  236. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  237. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  238. package/build/features/shared/Dialog/index.d.ts +4 -0
  239. package/build/features/shared/Dialog/index.js +4 -0
  240. package/build/features/shared/Input/Input.d.ts +1 -1
  241. package/build/features/shared/Input/Input.js +2 -2
  242. package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
  243. package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
  244. package/build/features/shared/UploadFile/UploadFile.js +24 -9
  245. package/build/features/signIn/SignIn.d.ts +1 -1
  246. package/build/features/signIn/SignIn.js +14 -6
  247. package/build/features/signIn/screens/Email/Email.js +4 -2
  248. package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
  249. package/build/features/signIn/screens/OTP/OTP.js +14 -1
  250. package/build/features/signIn/screens/Password/Password.js +15 -2
  251. package/build/features/tax/Tax.d.ts +1 -1
  252. package/build/features/tax/Tax.js +16 -8
  253. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -7
  254. package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
  255. package/build/features/tax/screens/Verify/Verify.js +16 -3
  256. package/build/hooks/index.d.ts +2 -0
  257. package/build/hooks/index.js +2 -0
  258. package/build/hooks/useAppConfig.d.ts +3 -1
  259. package/build/hooks/useAppConfig.js +4 -2
  260. package/build/hooks/useAppDispatch.d.ts +1 -1
  261. package/build/hooks/useErrorListener.js +0 -6
  262. package/build/hooks/useScreen.d.ts +3 -0
  263. package/build/hooks/useScreen.js +14 -0
  264. package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
  265. package/build/hooks/useSetFromDefaultValues.js +24 -0
  266. package/build/index.d.ts +3 -3
  267. package/build/index.js +5 -5
  268. package/build/utils/array.d.ts +13 -1
  269. package/build/utils/array.js +26 -0
  270. package/build/utils/common.d.ts +1 -0
  271. package/build/utils/common.js +3 -0
  272. package/build/utils/device.d.ts +1 -0
  273. package/build/utils/device.js +13 -0
  274. package/build/utils/html.d.ts +1 -0
  275. package/build/utils/html.js +6 -0
  276. package/build/utils/index.d.ts +1 -0
  277. package/build/utils/index.js +1 -0
  278. package/build/utils/locale.js +1 -1
  279. package/build/utils/object.d.ts +1 -0
  280. package/build/utils/object.js +12 -0
  281. package/build/utils/rsa.d.ts +2 -2
  282. package/build/utils/rsa.js +1 -1
  283. package/build/utils/string.d.ts +33 -20
  284. package/build/utils/string.js +71 -1
  285. package/build/utils/validation.d.ts +2 -0
  286. package/build/utils/validation.js +6 -0
  287. package/package.json +5 -4
  288. package/build/features/app/otp/otpStore.d.ts +0 -28
  289. package/build/features/app/otp/otpStore.js +0 -153
  290. package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
  291. package/build/features/business/screens/Activities/SalesChannels.js +0 -112
  292. package/build/features/otp/OTP.d.ts +0 -7
  293. package/build/features/otp/OTP.js +0 -58
  294. package/build/features/otp/index.d.ts +0 -0
  295. package/build/features/otp/index.js +0 -1
  296. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  297. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  298. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  299. package/build/features/otp/screens/OTPVerify/index.js +0 -2
@@ -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,93 @@ 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
+ if (countryIso2)
88
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
89
+ if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
90
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
91
+ }
92
+ if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
94
93
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
95
94
  }
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;
95
+ if (!(data.step_name === 'business_info')) return [3, 18];
96
+ steps = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.steps;
97
+ 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
98
  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);
99
+ hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) &&
100
+ hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
101
101
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
102
102
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
103
- if (!hasBusinessCompleted) return [3, 6];
104
- return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
103
+ entity_activities = leadResponse.data.entity_activities;
104
+ if (!(!entity_activities && hasBusinessCRInfoCompleted)) return [3, 4];
105
+ return [4, API.dataService.getActivities()];
106
+ case 3:
107
+ data_1 = _h.sent();
108
+ leadResponse.data = __assign(__assign({}, leadResponse.data), { entity_activities: data_1.list });
109
+ _h.label = 4;
110
+ case 4:
111
+ if (!hasBusinessCompleted) return [3, 8];
112
+ board_id = (_e = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _e === void 0 ? void 0 : _e.board_id;
113
+ board_info_id = (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_info_id;
114
+ if (!(!!board_id && !!board_info_id)) return [3, 6];
115
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
105
116
  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];
117
+ boardResponse = _h.sent();
118
+ _h.label = 6;
119
+ case 6: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
113
120
  case 7:
114
- if (!hasBusinessCustomersCompleted) return [3, 8];
115
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
116
- return [3, 17];
121
+ _h.sent();
122
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
123
+ return [3, 18];
117
124
  case 8:
118
- if (!hasBusinessCRActivitiesCompleted) return [3, 12];
119
- return [4, thunkApi.dispatch(retrieveChannels())];
125
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
126
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
127
+ return [3, 18];
120
128
  case 9:
121
- _g.sent();
122
- return [4, thunkApi.dispatch(retrieveDataList())];
129
+ if (!hasBusinessCustomersCompleted) return [3, 10];
130
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
131
+ return [3, 18];
123
132
  case 10:
124
- _g.sent();
133
+ if (!hasBusinessCRActivitiesCompleted) return [3, 13];
134
+ return [4, thunkApi.dispatch(retrieveDataList())];
135
+ case 11:
136
+ _h.sent();
125
137
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
126
138
  return [4, API.brandService.retrieveBrand(brandID)];
127
- case 11:
128
- brandInfo = _g.sent();
129
- return [3, 17];
130
139
  case 12:
131
- if (!hasBusinessCRInfoCompleted) return [3, 15];
132
- return [4, thunkApi.dispatch(retrieveChannels())];
140
+ brandInfo = _h.sent();
141
+ return [3, 18];
133
142
  case 13:
134
- _g.sent();
143
+ if (!hasBusinessCRInfoCompleted) return [3, 15];
135
144
  return [4, API.brandService.retrieveBrand(brandID)];
136
145
  case 14:
137
- brandInfo = _g.sent();
146
+ brandInfo = _h.sent();
138
147
  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 }))];
148
+ return [3, 18];
149
+ case 15:
150
+ if (!isSA(countryIso2)) return [3, 17];
151
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
141
152
  case 16:
142
- _g.sent();
153
+ _h.sent();
154
+ _h.label = 17;
155
+ case 17:
143
156
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
144
- _g.label = 17;
145
- case 17: return [2, {
157
+ _h.label = 18;
158
+ case 18: return [2, {
146
159
  data: data,
147
160
  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
161
  token: token,
149
162
  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
163
+ boardId: (_g = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _g === void 0 ? void 0 : _g.board_id
151
164
  }];
152
165
  }
153
166
  });
@@ -170,144 +183,240 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
170
183
  });
171
184
  }); });
172
185
  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) {
186
+ 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;
187
+ var _c, _d, _e, _f, _g, _h;
188
+ return __generator(this, function (_j) {
189
+ switch (_j.label) {
177
190
  case 0:
178
191
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
179
192
  isNID = business.data.otpData.isNID;
180
193
  responseBody = (isNID ? business.data.nidData : business.data.verify).responseBody;
181
- verifyResponse = business.data.verify.responseBody;
182
194
  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
195
  payload = {
185
196
  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),
197
+ 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),
198
+ 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
199
  step_name: stepName,
189
200
  encryption_contract: ['data']
190
201
  };
191
202
  return [4, API.leadService.verifyLeadOTP(payload)];
192
203
  case 1:
193
- data = (_k.sent()).data;
204
+ data = (_j.sent()).data;
194
205
  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 }))];
206
+ leadResponse = undefined;
207
+ if (!!data.errors) return [3, 20];
208
+ return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
198
209
  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;
210
+ leadResponse = _j.sent();
211
+ thunkApi.dispatch(updateStepName(stepName));
212
+ _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;
213
+ brandID = brand === null || brand === void 0 ? void 0 : brand.id;
214
+ countryIso2 = country_code;
215
+ if (countryIso2)
216
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
217
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
202
218
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
203
219
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
204
220
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
205
221
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
206
- if (!isNID) return [3, 3];
207
- thunkApi.dispatch(handleNextScreenStep());
208
- return [3, 13];
222
+ isIdentityAuthStep = data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH;
223
+ if (!(isSA(countryIso2) && !isIdentityAuthStep)) return [3, 4];
224
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
209
225
  case 3:
210
- if (!hasBusinessCompleted) return [3, 5];
211
- return [4, thunkApi.dispatch(retrieveBoardDetails(verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.board_id))];
226
+ _j.sent();
227
+ _j.label = 4;
212
228
  case 4:
213
- _k.sent();
214
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
215
- return [3, 13];
229
+ entity_activities = ((leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) || {}).entity_activities;
230
+ if (!(!entity_activities && hasBusinessCRInfoCompleted)) return [3, 6];
231
+ return [4, API.dataService.getActivities()];
216
232
  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];
233
+ data_2 = _j.sent();
234
+ leadResponse.data = __assign(__assign({}, leadResponse.data), { entity_activities: data_2.list });
235
+ _j.label = 6;
220
236
  case 6:
221
- if (!hasBusinessCustomersCompleted) return [3, 7];
222
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
223
- return [3, 13];
237
+ if (!isNID) return [3, 7];
238
+ thunkApi.dispatch(handleNextScreenStep());
239
+ return [3, 20];
224
240
  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)];
241
+ if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 8];
242
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
243
+ return [3, 20];
230
244
  case 8:
231
- brandInfo = _k.sent();
232
- return [3, 13];
245
+ if (!hasBusinessCompleted) return [3, 12];
246
+ if (!(!!board_id && !!board_info_id)) return [3, 10];
247
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
233
248
  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)];
249
+ boardResponse = _j.sent();
250
+ 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) });
251
+ _j.label = 10;
252
+ case 10: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
239
253
  case 11:
240
- brandInfo = _k.sent();
241
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
242
- return [3, 13];
254
+ _j.sent();
255
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
256
+ return [3, 20];
243
257
  case 12:
258
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 13];
259
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
260
+ return [3, 20];
261
+ case 13:
262
+ if (!hasBusinessCustomersCompleted) return [3, 14];
263
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
264
+ return [3, 20];
265
+ case 14:
266
+ if (!hasBusinessCRActivitiesCompleted) return [3, 17];
267
+ return [4, thunkApi.dispatch(retrieveDataList())];
268
+ case 15:
269
+ _j.sent();
270
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
271
+ return [4, API.brandService.retrieveBrand(brandID)];
272
+ case 16:
273
+ brandInfo = _j.sent();
274
+ return [3, 20];
275
+ case 17:
276
+ if (!hasBusinessCRInfoCompleted) return [3, 19];
277
+ return [4, API.brandService.retrieveBrand(brandID)];
278
+ case 18:
279
+ brandInfo = _j.sent();
280
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
281
+ return [3, 20];
282
+ case 19:
244
283
  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 }];
284
+ _j.label = 20;
285
+ 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 }];
286
+ }
287
+ });
288
+ }); });
289
+ export var verifyPACI = createAsyncThunk('businessVerifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
290
+ var _a, settings, business, responseBody, expiry, interval, maxCalls, count, data, isSuccess;
291
+ var _b, _c, _d, _e;
292
+ return __generator(this, function (_f) {
293
+ switch (_f.label) {
294
+ case 0:
295
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
296
+ responseBody = business.data.civilIdData.responseBody;
297
+ expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
298
+ interval = 5;
299
+ maxCalls = Math.floor(expiry / interval);
300
+ if (thunkApi.signal.aborted) {
301
+ return [2, { response: null }];
302
+ }
303
+ count = 1;
304
+ _f.label = 1;
305
+ case 1:
306
+ if (!(count <= maxCalls)) return [3, 7];
307
+ return [4, API.authService.getTokenVerify(responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token)];
308
+ case 2:
309
+ data = _f.sent();
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 [2, { response: data }];
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: throw new Error('paci_verification_failed');
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,28 @@ 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
- state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
776
+ var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities[0]) ? [activities === null || activities === void 0 ? void 0 : activities[0]] : [];
777
+ state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
633
778
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
779
+ state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
634
780
  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;
781
+ var licenseNumber_1 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
782
+ var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
637
783
  var licenseList = (responseBody || {}).licenseList;
638
784
  var selectedLicenseData = selectedLicense;
639
785
  if (!!licenseNumber_1) {
640
786
  selectedLicenseData =
641
- ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
787
+ ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
642
788
  var license = _a.license;
643
789
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_1;
644
790
  })) ||
645
- business_type === BusinessType.CR
646
- ? __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } });
791
+ business_type === BusinessType.FL
792
+ ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } });
647
793
  state.data.businessTypeData.licenseNumber = licenseNumber_1 || '';
648
794
  }
649
795
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
@@ -675,10 +821,10 @@ export var businessSlice = createSlice({
675
821
  state.error = null;
676
822
  })
677
823
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
678
- var _a, _b, _c, _d, _e, _f;
824
+ var _a, _b, _c, _d, _e;
679
825
  state.loading = false;
680
826
  state.error = null;
681
- var _g = action.payload, data = _g.data, formData = _g.formData, brandInfo = _g.brandInfo;
827
+ var _f = action.payload, data = _f.data, formData = _f.formData, brandInfo = _f.brandInfo, leadData = _f.leadData;
682
828
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
683
829
  if (description) {
684
830
  state.error = description;
@@ -686,55 +832,36 @@ export var businessSlice = createSlice({
686
832
  }
687
833
  state.data.otpData = formData;
688
834
  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;
835
+ 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 });
836
+ var _g = leadData || {}, entity = _g.entity, entity_activities = _g.entity_activities, business_type = _g.business_type, business_name = _g.business_name;
690
837
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
691
838
  ? 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;
839
+ : (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
693
840
  if (!!issuingDate) {
694
841
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
695
842
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
696
843
  }
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
844
  var activities = entity_activities || [];
719
845
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
720
846
  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(); });
847
+ 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
848
  });
723
849
  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
850
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
851
+ state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
725
852
  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;
853
+ var licenseNumber_2 = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
854
+ var _h = state.data.businessTypeData || {}, responseBody = _h.responseBody, selectedLicense = _h.selectedLicense;
728
855
  var licenseList = (responseBody || {}).licenseList;
729
856
  var selectedLicenseData = selectedLicense;
730
857
  if (!!licenseNumber_2) {
731
858
  selectedLicenseData =
732
- ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
859
+ ((_e = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _e === void 0 ? void 0 : _e.call(licenseList, function (_a) {
733
860
  var license = _a.license;
734
861
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
735
862
  })) ||
736
- business_type === BusinessType.CR
737
- ? __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } });
863
+ business_type === BusinessType.FL
864
+ ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } });
738
865
  state.data.businessTypeData.licenseNumber = licenseNumber_2 || '';
739
866
  }
740
867
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
@@ -743,6 +870,42 @@ export var businessSlice = createSlice({
743
870
  .addCase(verifyLeadOTP.rejected, function (state, action) {
744
871
  state.loading = false;
745
872
  state.error = action.error.message;
873
+ })
874
+ .addCase(createCivilIdAuth.pending, function (state, action) {
875
+ state.loading = true;
876
+ state.error = null;
877
+ })
878
+ .addCase(createCivilIdAuth.fulfilled, function (state, action) {
879
+ var _a;
880
+ state.loading = false;
881
+ state.error = null;
882
+ var _b = action.payload, formData = _b.formData, response = _b.response;
883
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
884
+ if (description) {
885
+ state.error = description;
886
+ return;
887
+ }
888
+ state.data.civilIdData = __assign(__assign({}, formData), { responseBody: response });
889
+ })
890
+ .addCase(createCivilIdAuth.rejected, function (state, action) {
891
+ state.loading = false;
892
+ state.error = action.error.message;
893
+ })
894
+ .addCase(verifyPACI.pending, function (state) {
895
+ state.loading = true;
896
+ state.error = null;
897
+ })
898
+ .addCase(verifyPACI.fulfilled, function (state, action) {
899
+ state.loading = false;
900
+ state.error = null;
901
+ state.data.otpData.responseBody = action.payload.response;
902
+ })
903
+ .addCase(verifyPACI.rejected, function (state, action) {
904
+ state.loading = false;
905
+ var error = action.error.message;
906
+ if (error !== 'Aborted') {
907
+ state.error = error;
908
+ }
746
909
  })
747
910
  .addCase(updateLeadIdentity.pending, function (state) {
748
911
  state.loading = true;
@@ -836,42 +999,6 @@ export var businessSlice = createSlice({
836
999
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
837
1000
  state.error = action.error.message;
838
1001
  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
1002
  })
876
1003
  .addCase(updateLeadBusinessType.pending, function (state) {
877
1004
  state.loading = true;
@@ -881,7 +1008,7 @@ export var businessSlice = createSlice({
881
1008
  var _a;
882
1009
  state.loading = false;
883
1010
  state.error = null;
884
- var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData;
1011
+ var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData, documentData = _b.documentData;
885
1012
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
886
1013
  var entity = data.entity, entity_activities = data.entity_activities;
887
1014
  var issuingDate = (_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date;
@@ -897,12 +1024,26 @@ export var businessSlice = createSlice({
897
1024
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
898
1025
  if (!!selectedActivity)
899
1026
  state.data.activitiesData.activities = [selectedActivity];
900
- state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData);
1027
+ state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
901
1028
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: entity });
902
1029
  })
903
1030
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
904
1031
  state.loading = false;
905
1032
  state.error = action.error.message;
1033
+ })
1034
+ .addCase(uploadLicenseCertificate.pending, function (state) {
1035
+ state.error = null;
1036
+ state.uploading = true;
1037
+ })
1038
+ .addCase(uploadLicenseCertificate.fulfilled, function (state, action) {
1039
+ state.error = null;
1040
+ state.uploading = false;
1041
+ var data = action.payload.data;
1042
+ state.data.businessTypeData.certificateId = data === null || data === void 0 ? void 0 : data.id;
1043
+ })
1044
+ .addCase(uploadLicenseCertificate.rejected, function (state) {
1045
+ state.uploading = false;
1046
+ state.error = 'file_upload_error';
906
1047
  })
907
1048
  .addCase(updateActivitiesInfo.pending, function (state) {
908
1049
  state.loading = true;
@@ -927,19 +1068,19 @@ export var businessSlice = createSlice({
927
1068
  state.error = null;
928
1069
  })
929
1070
  .addCase(retrieveDataList.fulfilled, function (state, action) {
930
- var _a, _b;
1071
+ var _a, _b, _c, _d, _e;
931
1072
  state.loading = false;
932
1073
  state.error = null;
933
1074
  var payload = action.payload;
934
- var customerBases = payload.customerBases || [];
1075
+ var customerBases = ((_a = payload.customerBases) === null || _a === void 0 ? void 0 : _a.list) || [];
935
1076
  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 || [];
1077
+ var expectedSales = ((_b = payload.expectedSales) === null || _b === void 0 ? void 0 : _b.list) || [];
1078
+ 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];
1079
+ var expectedCustomerSales = ((_e = payload.expectedCustomerSales) === null || _e === void 0 ? void 0 : _e.list) || [];
939
1080
  var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
940
1081
  state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
941
1082
  if (!!customerBase)
942
- state.data.customersData.customerLocations = [customerBase];
1083
+ state.data.customersData.customerLocations = [customerBase, customerBases[0]];
943
1084
  if (!!expectedSale)
944
1085
  state.data.customersData.expectedSale = expectedSale;
945
1086
  if (!!expectedCustomerSale)
@@ -965,7 +1106,7 @@ export var businessSlice = createSlice({
965
1106
  state.error = action.error.message;
966
1107
  })
967
1108
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
968
- var _a;
1109
+ var _a, _b;
969
1110
  state.loading = false;
970
1111
  state.error = null;
971
1112
  var response = (action.payload || {}).response;
@@ -974,7 +1115,7 @@ export var businessSlice = createSlice({
974
1115
  state.error = description;
975
1116
  return;
976
1117
  }
977
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), response);
1118
+ 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
1119
  })
979
1120
  .addCase(updateLeadSuccess.pending, function (state) {
980
1121
  state.loading = true;