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

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 (295) 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 +428 -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 +68 -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 +17 -4
  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 +16 -17
  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 +67 -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/Customers.js +15 -9
  143. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  144. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  145. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  146. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  147. package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
  148. package/build/features/business/screens/OTP/OTP.js +15 -2
  149. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -7
  150. package/build/features/business/screens/Verify/Verify.js +4 -4
  151. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  152. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
  153. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  154. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  155. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  156. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  157. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  158. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  159. package/build/features/connect/Connect.d.ts +2 -1
  160. package/build/features/connect/Connect.js +47 -12
  161. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  162. package/build/features/connect/screens/CivilID/CivilID.js +99 -0
  163. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  164. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  165. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  166. package/build/features/connect/screens/CivilID/index.js +2 -0
  167. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  168. package/build/features/connect/screens/CivilID/validation.js +4 -0
  169. package/build/features/connect/screens/Individual/Email.js +11 -3
  170. package/build/features/connect/screens/Individual/Individual.js +41 -27
  171. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  172. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  173. package/build/features/connect/screens/Merchant/Merchant.js +47 -50
  174. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +7 -0
  175. package/build/features/connect/screens/Merchant/SalesChannels.js +113 -0
  176. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  177. package/build/features/connect/screens/Merchant/SocialMedia.js +131 -66
  178. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  179. package/build/features/connect/screens/Merchant/validation.d.ts +22 -45
  180. package/build/features/connect/screens/Merchant/validation.js +117 -116
  181. package/build/features/connect/screens/Mobile/Mobile.js +29 -12
  182. package/build/features/connect/screens/NID/NID.js +2 -1
  183. package/build/features/connect/screens/OTP/OTP.js +20 -6
  184. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  185. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  186. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  187. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  188. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  189. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  190. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  191. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  192. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  193. package/build/features/entity/Entity.d.ts +1 -1
  194. package/build/features/entity/Entity.js +16 -9
  195. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
  196. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +140 -0
  197. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +65 -2
  198. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
  199. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
  200. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
  201. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
  202. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
  203. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
  204. package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.d.ts +0 -0
  205. package/build/features/{business/screens/Activities → entity/screens/EntityInfoConfirm}/SalesChannels.js +8 -5
  206. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
  207. package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
  208. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
  209. package/build/features/entity/screens/Verify/Verify.js +16 -3
  210. package/build/features/featuresScreens.d.ts +1 -1
  211. package/build/features/featuresScreens.js +31 -6
  212. package/build/features/individual/Individual.d.ts +1 -1
  213. package/build/features/individual/Individual.js +14 -7
  214. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +17 -24
  215. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  216. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  217. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  218. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
  219. package/build/features/individual/screens/Verify/Verify.js +18 -5
  220. package/build/features/password/Password.d.ts +1 -1
  221. package/build/features/password/Password.js +14 -7
  222. package/build/features/password/screens/CreatePassword/CreatePassword.js +15 -2
  223. package/build/features/password/screens/OTP/OTP.js +15 -2
  224. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -9
  225. package/build/features/password/screens/Verify/Verify.js +16 -3
  226. package/build/features/shared/Background/Background.d.ts +6 -5
  227. package/build/features/shared/Background/Background.js +16 -5
  228. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  229. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  230. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  231. package/build/features/shared/Button/MobileButton.js +2 -2
  232. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  233. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  234. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  235. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  236. package/build/features/shared/Dialog/index.d.ts +4 -0
  237. package/build/features/shared/Dialog/index.js +4 -0
  238. package/build/features/shared/Input/Input.d.ts +1 -1
  239. package/build/features/shared/Input/Input.js +2 -2
  240. package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
  241. package/build/features/shared/UploadFile/UploadFile.d.ts +9 -3
  242. package/build/features/shared/UploadFile/UploadFile.js +23 -8
  243. package/build/features/signIn/SignIn.d.ts +1 -1
  244. package/build/features/signIn/SignIn.js +14 -6
  245. package/build/features/signIn/screens/Email/Email.js +4 -2
  246. package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
  247. package/build/features/signIn/screens/OTP/OTP.js +14 -1
  248. package/build/features/signIn/screens/Password/Password.js +15 -2
  249. package/build/features/tax/Tax.d.ts +1 -1
  250. package/build/features/tax/Tax.js +16 -8
  251. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -7
  252. package/build/features/tax/screens/TaxDetails/TaxDetails.js +15 -2
  253. package/build/features/tax/screens/Verify/Verify.js +16 -3
  254. package/build/hooks/index.d.ts +2 -0
  255. package/build/hooks/index.js +2 -0
  256. package/build/hooks/useAppConfig.d.ts +3 -1
  257. package/build/hooks/useAppConfig.js +4 -2
  258. package/build/hooks/useAppDispatch.d.ts +1 -1
  259. package/build/hooks/useErrorListener.js +0 -6
  260. package/build/hooks/useScreen.d.ts +3 -0
  261. package/build/hooks/useScreen.js +14 -0
  262. package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
  263. package/build/hooks/useSetFromDefaultValues.js +24 -0
  264. package/build/index.d.ts +3 -3
  265. package/build/index.js +5 -5
  266. package/build/utils/array.d.ts +13 -1
  267. package/build/utils/array.js +26 -0
  268. package/build/utils/common.d.ts +1 -0
  269. package/build/utils/common.js +3 -0
  270. package/build/utils/device.d.ts +1 -0
  271. package/build/utils/device.js +13 -0
  272. package/build/utils/html.d.ts +1 -0
  273. package/build/utils/html.js +6 -0
  274. package/build/utils/index.d.ts +1 -0
  275. package/build/utils/index.js +1 -0
  276. package/build/utils/locale.js +1 -1
  277. package/build/utils/object.d.ts +1 -0
  278. package/build/utils/object.js +12 -0
  279. package/build/utils/rsa.d.ts +2 -2
  280. package/build/utils/rsa.js +1 -1
  281. package/build/utils/string.d.ts +33 -20
  282. package/build/utils/string.js +71 -1
  283. package/build/utils/validation.d.ts +2 -0
  284. package/build/utils/validation.js +6 -0
  285. package/package.json +129 -128
  286. package/build/features/app/otp/otpStore.d.ts +0 -28
  287. package/build/features/app/otp/otpStore.js +0 -153
  288. package/build/features/otp/OTP.d.ts +0 -7
  289. package/build/features/otp/OTP.js +0 -58
  290. package/build/features/otp/index.d.ts +0 -0
  291. package/build/features/otp/index.js +0 -1
  292. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  293. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  294. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  295. 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,239 @@ 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, 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
+ if (thunkApi.signal.aborted) {
299
+ return [2, { response: null }];
300
+ }
301
+ count = 1;
302
+ _f.label = 1;
303
+ case 1:
304
+ if (!(count <= maxCalls)) return [3, 7];
305
+ return [4, API.authService.getTokenVerify(responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token)];
306
+ case 2:
307
+ data = _f.sent();
308
+ isSuccess = ((_b = data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
309
+ if (!isSuccess) return [3, 4];
310
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, {});
311
+ return [4, ((_e = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _e === void 0 ? void 0 : _e.call(params))];
312
+ case 3:
313
+ _f.sent();
314
+ thunkApi.dispatch(handleNextScreenStep());
315
+ return [2, { response: data }];
316
+ case 4: return [4, sleep(interval * 1000)];
317
+ case 5:
318
+ _f.sent();
319
+ _f.label = 6;
320
+ case 6:
321
+ count++;
322
+ return [3, 1];
323
+ case 7: throw new Error('paci_verification_failed');
324
+ }
325
+ });
326
+ }); });
327
+ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
328
+ var _a, settings, business, stepName, lead_id, requestBody, data;
329
+ var _b, _c;
330
+ return __generator(this, function (_d) {
331
+ switch (_d.label) {
332
+ case 0:
333
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
334
+ stepName = BUSINESS_STEP_NAMES.CREATE_AUTH_CIVIL_ID;
335
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
336
+ requestBody = {
337
+ id: lead_id || '',
338
+ identification: {
339
+ id: params.civilId,
340
+ issued_country_code: settings.data.businessCountry.iso2,
341
+ type: 'civil_id'
342
+ },
343
+ step_name: stepName,
344
+ encryption_contract: ['identification.id', 'identification.issued_country_code', 'identification.type']
345
+ };
346
+ return [4, API.leadService.updateLead(requestBody)];
347
+ case 1:
348
+ data = _d.sent();
349
+ thunkApi.dispatch(handleNextScreenStep());
350
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
351
+ return [2, { response: data, formData: params }];
247
352
  }
248
353
  });
249
354
  }); });
250
355
  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) {
356
+ var _a, settings, business, identification_id_type, stepName, lead_id, requestBody, data;
357
+ var _b, _c;
358
+ return __generator(this, function (_d) {
359
+ switch (_d.label) {
255
360
  case 0:
256
361
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
257
362
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
258
363
  stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
364
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
259
365
  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,
366
+ id: lead_id || '',
367
+ identification: {
368
+ id: params.nid,
369
+ issued_country_code: settings.data.businessCountry.iso2,
370
+ type: identification_id_type
371
+ },
263
372
  date_of_birth: params.dob,
264
- country_code: settings.data.businessCountry.iso2,
265
373
  step_name: stepName,
266
- encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
374
+ encryption_contract: [
375
+ 'identification.issued_country_code',
376
+ 'identification.id',
377
+ 'identification.type',
378
+ 'date_of_birth'
379
+ ]
267
380
  };
268
381
  return [4, API.leadService.updateLead(requestBody)];
269
382
  case 1:
270
- data = _e.sent();
271
- thunkApi.dispatch(updateStepName(stepName));
383
+ data = _d.sent();
272
384
  thunkApi.dispatch(handleNextScreenStep());
273
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
385
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
274
386
  return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
275
387
  }
276
388
  });
277
389
  }); });
278
390
  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) {
391
+ var _a, settings, business, _b, nid, dob, type, stepName, lead_id, requestBody, data;
392
+ return __generator(this, function (_c) {
393
+ switch (_c.label) {
283
394
  case 0:
284
395
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
285
396
  _b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
286
397
  stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
398
+ lead_id = (business.data.verify.responseBody || {}).lead_id;
287
399
  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,
400
+ id: lead_id || '',
401
+ identification: {
402
+ id: nid,
403
+ issued_country_code: settings.data.businessCountry.iso2,
404
+ type: type
405
+ },
291
406
  date_of_birth: dob,
292
- country_code: settings.data.businessCountry.iso2,
293
407
  step_name: stepName,
294
- encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
408
+ encryption_contract: [
409
+ 'identification.issued_country_code',
410
+ 'identification.id',
411
+ 'identification.type',
412
+ 'date_of_birth'
413
+ ]
295
414
  };
296
415
  return [4, API.leadService.updateLead(requestBody)];
297
416
  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;
417
+ data = _c.sent();
311
418
  return [2, data];
312
419
  }
313
420
  });
@@ -332,31 +439,40 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
332
439
  case 1:
333
440
  data = _c.sent();
334
441
  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 })
442
+ 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
443
  }];
337
444
  }
338
445
  });
339
446
  }); });
340
447
  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;
448
+ var _a, settings, business, payload, data, entity_activities, list, accountBody, accountData, documentData, documentBody;
342
449
  var _b, _c, _d, _e, _f, _g;
343
450
  return __generator(this, function (_h) {
344
451
  switch (_h.label) {
345
452
  case 0:
346
453
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
347
454
  payload = {
348
- id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
455
+ id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
349
456
  license_number: params.licenseNumber,
350
457
  license_type: ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL ? 'freelance' : 'commercial_registration',
351
458
  business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
352
459
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
460
+ business: { ar: params.entityLegalName, en: params.entityLegalName },
353
461
  encryption_contract: ['license_number', 'business_type', 'license_type']
354
462
  };
355
463
  return [4, API.leadService.updateLead(payload)];
356
464
  case 1:
357
465
  data = _h.sent();
466
+ entity_activities = data.entity_activities;
467
+ if (!!entity_activities) return [3, 3];
468
+ return [4, API.dataService.getActivities()];
469
+ case 2:
470
+ list = (_h.sent()).list;
471
+ data.entity_activities = list;
472
+ _h.label = 3;
473
+ case 3:
358
474
  accountBody = {
359
- lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.id,
475
+ lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.lead_id,
360
476
  notify: {
361
477
  email: false,
362
478
  phone: false
@@ -366,43 +482,75 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
366
482
  step_name: BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM
367
483
  };
368
484
  return [4, API.accountService.createAccount(accountBody)];
369
- case 2:
485
+ case 4:
370
486
  accountData = _h.sent();
371
- return [4, thunkApi.dispatch(retrieveChannels())];
372
- case 3:
373
- _h.sent();
487
+ documentData = undefined;
488
+ if (!!!business.data.businessTypeData.certificateId) return [3, 6];
489
+ documentBody = {
490
+ entity_id: (accountData === null || accountData === void 0 ? void 0 : accountData.entity_id) || '',
491
+ documents: [
492
+ {
493
+ images: [business.data.businessTypeData.certificateId]
494
+ }
495
+ ]
496
+ };
497
+ return [4, API.entityService.updateDocumentInfo(documentBody)];
498
+ case 5:
499
+ documentData = _h.sent();
500
+ _h.label = 6;
501
+ case 6:
374
502
  thunkApi.dispatch(handleNextScreenStep());
375
503
  (_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 }];
504
+ return [2, { data: data, formData: params, accountData: accountData, documentData: documentData }];
377
505
  }
378
506
  });
379
507
  }); });
508
+ export var uploadLicenseCertificate = createAsyncThunk('uploadLicenseCertificate', function (_a) {
509
+ var file = _a.file, onProgress = _a.onProgress;
510
+ return __awaiter(void 0, void 0, void 0, function () {
511
+ var uploadPayload, onUploadProgress, data;
512
+ return __generator(this, function (_b) {
513
+ switch (_b.label) {
514
+ case 0:
515
+ uploadPayload = {
516
+ file_link_create: true,
517
+ title: file === null || file === void 0 ? void 0 : file.name,
518
+ purpose: 'identity_document',
519
+ file: file
520
+ };
521
+ onUploadProgress = function (progressEvent) {
522
+ var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
523
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
524
+ };
525
+ return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
526
+ case 1:
527
+ data = _b.sent();
528
+ return [2, { data: data }];
529
+ }
530
+ });
531
+ });
532
+ });
380
533
  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;
534
+ var _a, settings, business, activities, stepName, id, requestBody, data;
382
535
  var _b, _c, _d, _e, _f;
383
536
  return __generator(this, function (_g) {
384
537
  switch (_g.label) {
385
538
  case 0:
386
539
  _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
540
  activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
392
- var en = _a.en;
393
- return en;
541
+ var id = _a.id;
542
+ return ({ id: id });
394
543
  });
395
544
  stepName = BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES;
396
545
  id = (_d = (_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.id;
397
546
  requestBody = {
398
547
  id: id,
399
- brand: {
400
- activities: activities,
401
- channel_services: channel,
402
- business_operation_start_at: params.operationStartDate
548
+ activities: activities,
549
+ operations: {
550
+ start_date: params.operationStartDate
403
551
  },
404
552
  step_name: stepName,
405
- encryption_contract: ['brand.business_operation_start_at']
553
+ encryption_contract: ['operations.start_date']
406
554
  };
407
555
  return [4, API.brandService.updateBrandInfo(requestBody)];
408
556
  case 1:
@@ -415,17 +563,26 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
415
563
  }
416
564
  });
417
565
  }); });
418
- export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
419
- var _a, customerBases, expectedSales, expectedCustomerSales;
566
+ export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
567
+ var settings, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
420
568
  return __generator(this, function (_b) {
421
569
  switch (_b.label) {
422
- case 0: return [4, Promise.all([
423
- API.dataService.getCustomerBases(),
424
- API.dataService.getExpectedSales(),
425
- API.dataService.getExpectedCustomerSales()
426
- ])];
570
+ case 0:
571
+ settings = thunkApi.getState().settings;
572
+ dataBody = {
573
+ page: 0
574
+ };
575
+ salesDataBody = {
576
+ page: 0,
577
+ country_code: [settings.data.businessCountry.iso2]
578
+ };
579
+ return [4, Promise.all([
580
+ API.dataService.getCustomerBases(dataBody),
581
+ API.dataService.getExpectedSales(salesDataBody),
582
+ API.dataService.getExpectedCustomerSales(dataBody)
583
+ ])];
427
584
  case 1:
428
- _a = _b.sent(), customerBases = _a[0].data, expectedSales = _a[1].data, expectedCustomerSales = _a[2].data;
585
+ _a = _b.sent(), customerBases = _a[0], expectedSales = _a[1], expectedCustomerSales = _a[2];
429
586
  return [2, {
430
587
  customerBases: customerBases,
431
588
  expectedSales: expectedSales,
@@ -435,29 +592,28 @@ export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function
435
592
  });
436
593
  }); });
437
594
  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;
595
+ var _a, settings, business, id, customerLocation, customerBase, sales, stepName, requestBody, data;
439
596
  var _b, _c, _d, _e, _f, _g;
440
597
  return __generator(this, function (_h) {
441
598
  switch (_h.label) {
442
599
  case 0:
443
600
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
444
601
  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
- });
602
+ customerLocation = params.customerLocations.map(function (location) { return ({
603
+ id: location === null || location === void 0 ? void 0 : location.id
604
+ }); });
605
+ customerBase = { id: ((_d = params.expectedCustomer) === null || _d === void 0 ? void 0 : _d.id) || '', period: 'monthly', locations: customerLocation };
606
+ sales = { id: ((_e = params.expectedSale) === null || _e === void 0 ? void 0 : _e.id) || '', period: 'monthly' };
449
607
  stepName = BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS;
450
608
  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
609
+ operations: {
610
+ customer_base: customerBase,
611
+ sales: sales
457
612
  },
613
+ term: ['refund', 'chargeback'],
458
614
  id: id,
459
615
  step_name: stepName,
460
- encryption_contract: ['brand.customers_served_monthly', 'brand.monthly_sales_range']
616
+ encryption_contract: []
461
617
  };
462
618
  return [4, API.brandService.updateBrandInfo(requestBody)];
463
619
  case 1:
@@ -470,21 +626,21 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
470
626
  });
471
627
  }); });
472
628
  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;
629
+ var _a, settings, business, _b, steps, lead_id, flowCompleted, boardResponse, payload, data, board_id, board_info_id;
474
630
  var _c, _d, _e, _f;
475
631
  return __generator(this, function (_g) {
476
632
  switch (_g.label) {
477
633
  case 0:
478
634
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
479
- _b = business.data.verify.responseBody || {}, steps = _b.steps, id = _b.id;
635
+ _b = business.data.verify.responseBody || {}, steps = _b.steps, lead_id = _b.lead_id;
480
636
  flowCompleted = Object.keys(steps).find(function (key) { return key === BUSINESS_STEP_NAMES.BUSINESS_SUCCESS; });
481
- if (flowCompleted || !id)
637
+ if (flowCompleted || !lead_id)
482
638
  return [2];
483
639
  boardResponse = undefined;
484
640
  payload = {
485
641
  lang: settings.data.language,
486
642
  step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
487
- id: id,
643
+ id: lead_id,
488
644
  encryption_contract: []
489
645
  };
490
646
  return [4, API.leadService.updateLead(payload)];
@@ -497,7 +653,9 @@ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', fun
497
653
  case 2:
498
654
  boardResponse = _g.sent();
499
655
  _g.label = 3;
500
- case 3:
656
+ case 3: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
657
+ case 4:
658
+ _g.sent();
501
659
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
502
660
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
503
661
  thunkApi.dispatch(handleNextScreenStep());
@@ -517,7 +675,7 @@ export var updateStepName = createAsyncThunk('updateStepName', function (stepNam
517
675
  business = thunkApi.getState().business;
518
676
  payload = {
519
677
  step_name: stepName,
520
- id: ((_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id) || '',
678
+ id: ((_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.lead_id) || '',
521
679
  encryption_contract: []
522
680
  };
523
681
  return [4, API.leadService.updateLead(payload)];
@@ -531,6 +689,7 @@ var initialState = {
531
689
  error: null,
532
690
  loading: false,
533
691
  customLoading: false,
692
+ uploading: false,
534
693
  data: {
535
694
  flowName: FlowsTypes.BUSINESS,
536
695
  verify: {
@@ -540,18 +699,22 @@ var initialState = {
540
699
  otp: '',
541
700
  isNID: false
542
701
  },
702
+ civilIdData: {
703
+ civilId: ''
704
+ },
543
705
  nidData: {
544
706
  nid: '',
545
707
  dob: getEighteenYearsAgo(),
546
708
  type: ''
547
709
  },
548
710
  businessTypeData: {
549
- licenseNumber: ''
711
+ licenseNumber: '',
712
+ entityLegalName: '',
713
+ uploading: false
550
714
  },
551
715
  activitiesData: {
552
716
  activities: [],
553
- salesChannels: [],
554
- operationStartDate: '1998-08-22'
717
+ operationStartDate: new Date().toString()
555
718
  },
556
719
  customersData: {
557
720
  customerLocations: [],
@@ -583,19 +746,19 @@ export var businessSlice = createSlice({
583
746
  state.customLoading = true;
584
747
  })
585
748
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
586
- var _a, _b, _c, _d, _e, _f;
749
+ var _a, _b, _c, _d;
587
750
  state.error = null;
588
751
  state.customLoading = false;
589
- var _g = action.payload, data = _g.data, token = _g.token, leadData = _g.leadData, brandInfo = _g.brandInfo, boardId = _g.boardId;
752
+ var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo, boardId = _e.boardId;
590
753
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
591
754
  if (description) {
592
755
  state.error = description;
593
756
  return;
594
757
  }
595
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId });
758
+ 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
759
  state.data.verify.token = token;
597
760
  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;
761
+ 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
762
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
600
763
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
601
764
  : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
@@ -603,47 +766,27 @@ export var businessSlice = createSlice({
603
766
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
604
767
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
605
768
  }
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
769
  var activities = entity_activities || [];
628
770
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
629
771
  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(); });
772
+ 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
773
  });
632
774
  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
775
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
776
+ state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
634
777
  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;
778
+ var licenseNumber_1 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
779
+ var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
637
780
  var licenseList = (responseBody || {}).licenseList;
638
781
  var selectedLicenseData = selectedLicense;
639
782
  if (!!licenseNumber_1) {
640
783
  selectedLicenseData =
641
- ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
784
+ ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
642
785
  var license = _a.license;
643
786
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_1;
644
787
  })) ||
645
- business_type === BusinessType.CR
646
- ? __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } });
788
+ business_type === BusinessType.FL
789
+ ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_1 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_1 } });
647
790
  state.data.businessTypeData.licenseNumber = licenseNumber_1 || '';
648
791
  }
649
792
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
@@ -675,10 +818,10 @@ export var businessSlice = createSlice({
675
818
  state.error = null;
676
819
  })
677
820
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
678
- var _a, _b, _c, _d, _e, _f;
821
+ var _a, _b, _c, _d, _e;
679
822
  state.loading = false;
680
823
  state.error = null;
681
- var _g = action.payload, data = _g.data, formData = _g.formData, brandInfo = _g.brandInfo;
824
+ var _f = action.payload, data = _f.data, formData = _f.formData, brandInfo = _f.brandInfo, leadData = _f.leadData;
682
825
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
683
826
  if (description) {
684
827
  state.error = description;
@@ -686,55 +829,36 @@ export var businessSlice = createSlice({
686
829
  }
687
830
  state.data.otpData = formData;
688
831
  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;
832
+ 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 });
833
+ var _g = leadData || {}, entity = _g.entity, entity_activities = _g.entity_activities, business_type = _g.business_type, business_name = _g.business_name;
690
834
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
691
835
  ? 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;
836
+ : (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
693
837
  if (!!issuingDate) {
694
838
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
695
839
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
696
840
  }
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
841
  var activities = entity_activities || [];
719
842
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
720
843
  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(); });
844
+ 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
845
  });
723
846
  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
847
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
848
+ state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
725
849
  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;
850
+ var licenseNumber_2 = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
851
+ var _h = state.data.businessTypeData || {}, responseBody = _h.responseBody, selectedLicense = _h.selectedLicense;
728
852
  var licenseList = (responseBody || {}).licenseList;
729
853
  var selectedLicenseData = selectedLicense;
730
854
  if (!!licenseNumber_2) {
731
855
  selectedLicenseData =
732
- ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
856
+ ((_e = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _e === void 0 ? void 0 : _e.call(licenseList, function (_a) {
733
857
  var license = _a.license;
734
858
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
735
859
  })) ||
736
- business_type === BusinessType.CR
737
- ? __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } });
860
+ business_type === BusinessType.FL
861
+ ? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: licenseNumber_2 } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: licenseNumber_2 } });
738
862
  state.data.businessTypeData.licenseNumber = licenseNumber_2 || '';
739
863
  }
740
864
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
@@ -743,6 +867,42 @@ export var businessSlice = createSlice({
743
867
  .addCase(verifyLeadOTP.rejected, function (state, action) {
744
868
  state.loading = false;
745
869
  state.error = action.error.message;
870
+ })
871
+ .addCase(createCivilIdAuth.pending, function (state, action) {
872
+ state.loading = true;
873
+ state.error = null;
874
+ })
875
+ .addCase(createCivilIdAuth.fulfilled, function (state, action) {
876
+ var _a;
877
+ state.loading = false;
878
+ state.error = null;
879
+ var _b = action.payload, formData = _b.formData, response = _b.response;
880
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
881
+ if (description) {
882
+ state.error = description;
883
+ return;
884
+ }
885
+ state.data.civilIdData = __assign(__assign({}, formData), { responseBody: response });
886
+ })
887
+ .addCase(createCivilIdAuth.rejected, function (state, action) {
888
+ state.loading = false;
889
+ state.error = action.error.message;
890
+ })
891
+ .addCase(verifyPACI.pending, function (state) {
892
+ state.loading = true;
893
+ state.error = null;
894
+ })
895
+ .addCase(verifyPACI.fulfilled, function (state, action) {
896
+ state.loading = false;
897
+ state.error = null;
898
+ state.data.otpData.responseBody = action.payload.response;
899
+ })
900
+ .addCase(verifyPACI.rejected, function (state, action) {
901
+ state.loading = false;
902
+ var error = action.error.message;
903
+ if (error !== 'Aborted') {
904
+ state.error = error;
905
+ }
746
906
  })
747
907
  .addCase(updateLeadIdentity.pending, function (state) {
748
908
  state.loading = true;
@@ -836,42 +996,6 @@ export var businessSlice = createSlice({
836
996
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
837
997
  state.error = action.error.message;
838
998
  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
999
  })
876
1000
  .addCase(updateLeadBusinessType.pending, function (state) {
877
1001
  state.loading = true;
@@ -881,7 +1005,7 @@ export var businessSlice = createSlice({
881
1005
  var _a;
882
1006
  state.loading = false;
883
1007
  state.error = null;
884
- var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData;
1008
+ var _b = action.payload, data = _b.data, formData = _b.formData, accountData = _b.accountData, documentData = _b.documentData;
885
1009
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
886
1010
  var entity = data.entity, entity_activities = data.entity_activities;
887
1011
  var issuingDate = (_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.issuing_date;
@@ -897,12 +1021,26 @@ export var businessSlice = createSlice({
897
1021
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
898
1022
  if (!!selectedActivity)
899
1023
  state.data.activitiesData.activities = [selectedActivity];
900
- state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData);
1024
+ state.data.businessTypeData.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities }), accountData), documentData);
901
1025
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: entity });
902
1026
  })
903
1027
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
904
1028
  state.loading = false;
905
1029
  state.error = action.error.message;
1030
+ })
1031
+ .addCase(uploadLicenseCertificate.pending, function (state) {
1032
+ state.error = null;
1033
+ state.uploading = true;
1034
+ })
1035
+ .addCase(uploadLicenseCertificate.fulfilled, function (state, action) {
1036
+ state.error = null;
1037
+ state.uploading = false;
1038
+ var data = action.payload.data;
1039
+ state.data.businessTypeData.certificateId = data === null || data === void 0 ? void 0 : data.id;
1040
+ })
1041
+ .addCase(uploadLicenseCertificate.rejected, function (state) {
1042
+ state.uploading = false;
1043
+ state.error = 'file_upload_error';
906
1044
  })
907
1045
  .addCase(updateActivitiesInfo.pending, function (state) {
908
1046
  state.loading = true;
@@ -927,19 +1065,19 @@ export var businessSlice = createSlice({
927
1065
  state.error = null;
928
1066
  })
929
1067
  .addCase(retrieveDataList.fulfilled, function (state, action) {
930
- var _a, _b;
1068
+ var _a, _b, _c, _d, _e;
931
1069
  state.loading = false;
932
1070
  state.error = null;
933
1071
  var payload = action.payload;
934
- var customerBases = payload.customerBases || [];
1072
+ var customerBases = ((_a = payload.customerBases) === null || _a === void 0 ? void 0 : _a.list) || [];
935
1073
  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 || [];
1074
+ var expectedSales = ((_b = payload.expectedSales) === null || _b === void 0 ? void 0 : _b.list) || [];
1075
+ 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];
1076
+ var expectedCustomerSales = ((_e = payload.expectedCustomerSales) === null || _e === void 0 ? void 0 : _e.list) || [];
939
1077
  var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[3];
940
1078
  state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
941
1079
  if (!!customerBase)
942
- state.data.customersData.customerLocations = [customerBase];
1080
+ state.data.customersData.customerLocations = [customerBase, customerBases[0]];
943
1081
  if (!!expectedSale)
944
1082
  state.data.customersData.expectedSale = expectedSale;
945
1083
  if (!!expectedCustomerSale)
@@ -965,7 +1103,7 @@ export var businessSlice = createSlice({
965
1103
  state.error = action.error.message;
966
1104
  })
967
1105
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
968
- var _a;
1106
+ var _a, _b;
969
1107
  state.loading = false;
970
1108
  state.error = null;
971
1109
  var response = (action.payload || {}).response;
@@ -974,7 +1112,7 @@ export var businessSlice = createSlice({
974
1112
  state.error = description;
975
1113
  return;
976
1114
  }
977
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), response);
1115
+ 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
1116
  })
979
1117
  .addCase(updateLeadSuccess.pending, function (state) {
980
1118
  state.loading = true;