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

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 +50 -20
  2. package/build/@types/app.js +9 -3
  3. package/build/@types/form.d.ts +20 -12
  4. package/build/api/auth.d.ts +28 -5
  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 +51 -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 +0 -1
  23. package/build/app/rootReducer.js +0 -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 +1 -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 +4 -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 +4 -1
  34. package/build/components/AnimationFlow/Dialog.js +7 -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 +6 -5
  62. package/build/constants/app.js +53 -28
  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 +10 -0
  68. package/build/constants/validation.js +11 -1
  69. package/build/features/app/auth/authStore.d.ts +30 -4
  70. package/build/features/app/auth/authStore.js +182 -20
  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 +444 -295
  75. package/build/features/app/connect/connectStore.d.ts +34 -31
  76. package/build/features/app/connect/connectStore.js +427 -300
  77. package/build/features/app/entity/entityStore.d.ts +27 -7
  78. package/build/features/app/entity/entityStore.js +230 -146
  79. package/build/features/app/individual/individualStore.d.ts +18 -0
  80. package/build/features/app/individual/individualStore.js +176 -83
  81. package/build/features/app/password/passwordStore.js +1 -1
  82. package/build/features/app/tax/taxStore.js +21 -14
  83. package/build/features/auth/Auth.d.ts +3 -1
  84. package/build/features/auth/Auth.js +47 -12
  85. package/build/features/auth/screens/NID/DOB.d.ts +7 -0
  86. package/build/features/auth/screens/NID/DOB.js +47 -0
  87. package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
  88. package/build/features/auth/screens/NID/IDNumber.js +64 -0
  89. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  90. package/build/features/auth/screens/NID/NID.js +68 -0
  91. package/build/features/auth/screens/NID/TAC.d.ts +3 -0
  92. package/build/features/auth/screens/NID/TAC.js +87 -0
  93. package/build/features/auth/screens/NID/index.d.ts +3 -0
  94. package/build/features/auth/screens/NID/index.js +2 -0
  95. package/build/features/auth/screens/NID/validation.d.ts +27 -0
  96. package/build/features/auth/screens/NID/validation.js +19 -0
  97. package/build/features/auth/screens/OTP/OTP.js +8 -4
  98. package/build/features/auth/screens/OTP/OTPInput.js +9 -2
  99. package/build/features/bank/Bank.js +12 -6
  100. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
  101. package/build/features/bank/screens/BankDetails/BankName.js +2 -1
  102. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  103. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  104. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  105. package/build/features/bank/screens/Success/Success.js +7 -3
  106. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
  107. package/build/features/business/Business.d.ts +1 -1
  108. package/build/features/business/Business.js +14 -7
  109. package/build/features/business/screens/Activities/Activities.js +16 -17
  110. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  111. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  112. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  113. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  114. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  115. package/build/features/business/screens/Activities/validation.js +0 -9
  116. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  117. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  118. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  119. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  120. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  121. package/build/features/business/screens/BusinessType/LicenseList.js +24 -7
  122. package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
  123. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  124. package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
  125. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  126. package/build/features/business/screens/BusinessType/validation.js +52 -3
  127. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  128. package/build/features/business/screens/CivilID/CivilID.js +67 -0
  129. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  130. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  131. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  132. package/build/features/business/screens/CivilID/index.js +2 -0
  133. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  134. package/build/features/business/screens/CivilID/validation.js +4 -0
  135. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  136. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  137. package/build/features/business/screens/Customers/Customers.js +15 -9
  138. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  139. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  140. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  141. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  142. package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
  143. package/build/features/business/screens/OTP/OTP.js +15 -2
  144. package/build/features/business/screens/Success/Success.js +10 -3
  145. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -10
  146. package/build/features/business/screens/Verify/Verify.js +4 -4
  147. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  148. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
  149. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  150. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  151. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  152. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  153. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  154. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  155. package/build/features/connect/Connect.d.ts +2 -1
  156. package/build/features/connect/Connect.js +47 -12
  157. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  158. package/build/features/connect/screens/CivilID/CivilID.js +102 -0
  159. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  160. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  161. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  162. package/build/features/connect/screens/CivilID/index.js +2 -0
  163. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  164. package/build/features/connect/screens/CivilID/validation.js +4 -0
  165. package/build/features/connect/screens/Individual/Email.js +11 -3
  166. package/build/features/connect/screens/Individual/Individual.js +44 -28
  167. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  168. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  169. package/build/features/connect/screens/Merchant/Merchant.js +41 -64
  170. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
  171. package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
  172. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
  173. package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
  174. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  175. package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
  176. package/build/features/connect/screens/Merchant/validation.js +108 -173
  177. package/build/features/connect/screens/Mobile/Mobile.js +33 -12
  178. package/build/features/connect/screens/NID/NID.js +5 -1
  179. package/build/features/connect/screens/OTP/OTP.js +20 -6
  180. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  181. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  182. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  183. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  184. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  185. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  186. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  187. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  188. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  189. package/build/features/entity/Entity.d.ts +1 -1
  190. package/build/features/entity/Entity.js +16 -9
  191. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +2 -1
  192. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +25 -15
  193. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
  194. package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
  195. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +26 -7
  196. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
  197. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +25 -4
  198. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
  199. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +12 -51
  200. package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -10
  201. package/build/features/entity/screens/Success/Success.js +7 -3
  202. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -8
  203. package/build/features/entity/screens/Verify/Verify.js +18 -5
  204. package/build/features/featuresScreens.d.ts +0 -1
  205. package/build/features/featuresScreens.js +25 -7
  206. package/build/features/individual/Individual.d.ts +1 -1
  207. package/build/features/individual/Individual.js +14 -7
  208. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
  209. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  210. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  211. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  212. package/build/features/individual/screens/Success/Success.js +7 -3
  213. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
  214. package/build/features/individual/screens/Verify/Verify.js +18 -5
  215. package/build/features/password/Password.d.ts +1 -1
  216. package/build/features/password/Password.js +14 -7
  217. package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
  218. package/build/features/password/screens/OTP/OTP.js +15 -2
  219. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -12
  220. package/build/features/password/screens/Verify/Verify.js +16 -3
  221. package/build/features/shared/Background/Background.d.ts +4 -5
  222. package/build/features/shared/Background/Background.js +16 -5
  223. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  224. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  225. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  226. package/build/features/shared/Button/MobileButton.js +2 -2
  227. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  228. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  229. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  230. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  231. package/build/features/shared/Dialog/index.d.ts +4 -0
  232. package/build/features/shared/Dialog/index.js +4 -0
  233. package/build/features/shared/Input/Input.d.ts +1 -1
  234. package/build/features/shared/Input/Input.js +2 -2
  235. package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -2
  236. package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
  237. package/build/features/shared/UploadFile/UploadFile.js +24 -9
  238. package/build/features/signIn/SignIn.d.ts +1 -1
  239. package/build/features/signIn/SignIn.js +14 -6
  240. package/build/features/signIn/screens/Email/Email.js +4 -2
  241. package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
  242. package/build/features/signIn/screens/OTP/OTP.js +14 -1
  243. package/build/features/signIn/screens/Password/Password.js +15 -2
  244. package/build/features/tax/Tax.d.ts +1 -1
  245. package/build/features/tax/Tax.js +16 -8
  246. package/build/features/tax/screens/Success/Success.js +9 -3
  247. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -10
  248. package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
  249. package/build/features/tax/screens/Verify/Verify.js +16 -3
  250. package/build/hooks/index.d.ts +2 -0
  251. package/build/hooks/index.js +2 -0
  252. package/build/hooks/useAppConfig.d.ts +3 -1
  253. package/build/hooks/useAppConfig.js +4 -2
  254. package/build/hooks/useAppDispatch.d.ts +0 -1
  255. package/build/hooks/useErrorListener.js +0 -6
  256. package/build/hooks/useScreen.d.ts +3 -0
  257. package/build/hooks/useScreen.js +14 -0
  258. package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
  259. package/build/hooks/useSetFromDefaultValues.js +24 -0
  260. package/build/index.d.ts +2 -3
  261. package/build/index.js +1 -4
  262. package/build/utils/array.d.ts +49 -1
  263. package/build/utils/array.js +58 -0
  264. package/build/utils/common.d.ts +1 -0
  265. package/build/utils/common.js +3 -0
  266. package/build/utils/device.d.ts +1 -0
  267. package/build/utils/device.js +13 -0
  268. package/build/utils/html.d.ts +1 -0
  269. package/build/utils/html.js +6 -0
  270. package/build/utils/index.d.ts +1 -0
  271. package/build/utils/index.js +1 -0
  272. package/build/utils/locale.js +1 -1
  273. package/build/utils/object.d.ts +1 -0
  274. package/build/utils/object.js +12 -0
  275. package/build/utils/rsa.d.ts +2 -2
  276. package/build/utils/rsa.js +1 -1
  277. package/build/utils/string.d.ts +33 -20
  278. package/build/utils/string.js +71 -1
  279. package/build/utils/validation.d.ts +2 -0
  280. package/build/utils/validation.js +6 -0
  281. package/package.json +5 -4
  282. package/build/features/app/otp/otpStore.d.ts +0 -28
  283. package/build/features/app/otp/otpStore.js +0 -153
  284. package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
  285. package/build/features/business/screens/Activities/SalesChannels.js +0 -112
  286. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
  287. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
  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/OTPInput.js +0 -47
  294. package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
  295. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  296. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  297. package/build/features/otp/screens/OTPVerify/index.js +0 -2
  298. package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
  299. package/build/features/otp/screens/OTPVerify/validation.js +0 -4
@@ -3,11 +3,14 @@ import { EntityFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  boardResponse: {
6
- flows: {
7
- name: string;
8
- status: string;
9
- url: string;
10
- }[];
6
+ user: any;
7
+ brand: any;
8
+ bank_account: any;
9
+ entity: any;
10
+ merchant: any;
11
+ name: any;
12
+ contact: any;
13
+ flows: any;
11
14
  };
12
15
  token: string;
13
16
  }, string, {}>;
@@ -16,20 +19,36 @@ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
16
19
  }, void, {}>;
17
20
  export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
18
21
  data: any;
22
+ boardResponse: {
23
+ user: any;
24
+ brand: any;
25
+ bank_account: any;
26
+ entity: any;
27
+ merchant: any;
28
+ name: any;
29
+ contact: any;
30
+ flows: any;
31
+ };
19
32
  formData: OTPFormValues;
20
33
  }, OTPFormValues, {}>;
21
34
  export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
22
35
  data: any;
23
36
  }, string, {}>;
24
- export declare const updateEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
37
+ export declare const updateEntity: import("@reduxjs/toolkit").AsyncThunk<{
25
38
  data: any;
26
39
  formData: EntityFormValues;
27
40
  }, EntityFormValues, {}>;
41
+ interface UploadArticleParams {
42
+ file: File;
43
+ onProgress?: (value: number) => void;
44
+ }
45
+ export declare const uploadArticle: import("@reduxjs/toolkit").AsyncThunk<{
46
+ data: any;
47
+ }, UploadArticleParams, {}>;
28
48
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
29
49
  response: any;
30
50
  formData: void;
31
51
  } | undefined, void, {}>;
32
- export declare const retrieveChannels: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
33
52
  declare type VerifyData = {
34
53
  token: string;
35
54
  };
@@ -41,6 +60,7 @@ export interface EntityData {
41
60
  }
42
61
  export interface EntityState extends SharedState<EntityData> {
43
62
  customLoading?: boolean;
63
+ uploading?: boolean;
44
64
  }
45
65
  export declare const entitySlice: import("@reduxjs/toolkit").Slice<EntityState, {
46
66
  clearError: (state: EntityState) => void;
@@ -49,15 +49,15 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
53
- import { ENTITY_STEP_NAMES, BUSINESS_FLOW_SUCCESS } from '../../../constants';
52
+ import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
+ import { ENTITY_STEP_NAMES } from '../../../constants';
54
54
  import moment from 'moment';
55
55
  import { convertNumbers2English } from '../../../utils';
56
56
  export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
57
- var payload, data, boardInfoData, board_id, board_info_id, info, hasEntityCompleted;
58
- var _a;
59
- return __generator(this, function (_b) {
60
- switch (_b.label) {
57
+ var payload, data, boardData, entityData, boardInfoData, countryIso2, board_id, board_info_id, entityId, info, hasEntityCompleted;
58
+ var _a, _b, _c, _d;
59
+ return __generator(this, function (_e) {
60
+ switch (_e.label) {
61
61
  case 0:
62
62
  payload = {
63
63
  service_name: 'tap_email',
@@ -65,36 +65,64 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
65
65
  };
66
66
  return [4, API.leadService.verifyLeadToken(payload)];
67
67
  case 1:
68
- data = (_b.sent()).data;
69
- return [4, thunkApi.dispatch(retrieveChannels())];
70
- case 2:
71
- _b.sent();
72
- boardInfoData = undefined;
73
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 6];
68
+ data = (_e.sent()).data;
69
+ countryIso2 = undefined;
70
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
71
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
72
+ countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
73
+ if (countryIso2)
74
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
75
+ }
76
+ if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 8];
74
77
  board_id = data === null || data === void 0 ? void 0 : data.id;
75
78
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
76
- if (!(!!board_id && !!board_info_id)) return [3, 4];
79
+ if (!(board_id && board_info_id)) return [3, 3];
77
80
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
81
+ case 2:
82
+ boardInfoData = _e.sent();
83
+ _e.label = 3;
78
84
  case 3:
79
- boardInfoData = _b.sent();
80
- _b.label = 4;
81
- case 4: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
85
+ if (!board_id) return [3, 5];
86
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
87
+ case 4:
88
+ boardData = _e.sent();
89
+ _e.label = 5;
82
90
  case 5:
83
- _b.sent();
84
- info = boardInfoData.info;
85
- hasEntityCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
86
- thunkApi.dispatch(handleCurrentActiveScreen('ENTITY_INFO_STEP'));
87
- if (data.step_name === ENTITY_STEP_NAMES.PHONE_AUTH) {
88
- thunkApi.dispatch(handleCurrentActiveScreen('ENTITY_INFO_STEP'));
91
+ entityId = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.id;
92
+ if (!entityId) return [3, 7];
93
+ return [4, API.entityService.retrieveEntity(entityId)];
94
+ case 6:
95
+ entityData = _e.sent();
96
+ _e.label = 7;
97
+ case 7:
98
+ if (!countryIso2) {
99
+ countryIso2 = entityData.country;
100
+ if (countryIso2)
101
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
89
102
  }
90
- else if (hasEntityCompleted) {
103
+ info = boardInfoData.info;
104
+ hasEntityCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
105
+ if (hasEntityCompleted) {
91
106
  thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
92
107
  }
93
- else if (data.step_name === ENTITY_STEP_NAMES.ENTITY_INFO) {
108
+ else {
94
109
  thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
95
110
  }
96
- _b.label = 6;
97
- case 6: return [2, { data: data, boardResponse: { flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) }, token: token }];
111
+ _e.label = 8;
112
+ case 8: return [2, {
113
+ data: data,
114
+ boardResponse: {
115
+ user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
116
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
117
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
118
+ entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
119
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
120
+ name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
121
+ contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
122
+ flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info
123
+ },
124
+ token: token
125
+ }];
98
126
  }
99
127
  });
100
128
  }); });
@@ -116,14 +144,13 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
116
144
  });
117
145
  }); });
118
146
  export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
119
- var _a, entity, settings, responseBody, flows, payload, data, hasEntityCompleted;
120
- var _b, _c, _d, _e;
121
- return __generator(this, function (_f) {
122
- switch (_f.label) {
147
+ var _a, entity, settings, responseBody, payload, data, boardData, entityData, boardInfoData, board_id, board_info_id, entityId, info, hasEntityCompleted;
148
+ var _b, _c, _d, _e, _f, _g, _h;
149
+ return __generator(this, function (_j) {
150
+ switch (_j.label) {
123
151
  case 0:
124
152
  _a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
125
153
  responseBody = entity.data.verify.responseBody;
126
- flows = (responseBody || {}).flows;
127
154
  payload = {
128
155
  data: params.otp,
129
156
  service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
@@ -133,18 +160,54 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
133
160
  };
134
161
  return [4, API.leadService.verifyLeadOTP(payload)];
135
162
  case 1:
136
- data = (_f.sent()).data;
137
- if (!data.errors) {
138
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
139
- hasEntityCompleted = ((_e = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'entity'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
140
- if (hasEntityCompleted) {
141
- thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
142
- }
143
- else {
144
- thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
145
- }
163
+ data = (_j.sent()).data;
164
+ boardInfoData = undefined;
165
+ if (!!data.errors) return [3, 8];
166
+ board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
167
+ board_info_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.board_info_id;
168
+ if (!(board_id && board_info_id)) return [3, 3];
169
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
170
+ case 2:
171
+ boardInfoData = _j.sent();
172
+ _j.label = 3;
173
+ case 3:
174
+ if (!board_id) return [3, 5];
175
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
176
+ case 4:
177
+ boardData = _j.sent();
178
+ _j.label = 5;
179
+ case 5:
180
+ entityId = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.id;
181
+ if (!entityId) return [3, 7];
182
+ return [4, API.entityService.retrieveEntity(entityId)];
183
+ case 6:
184
+ entityData = _j.sent();
185
+ _j.label = 7;
186
+ case 7:
187
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
188
+ info = boardInfoData.info;
189
+ hasEntityCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
190
+ if (hasEntityCompleted) {
191
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
192
+ }
193
+ else {
194
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
146
195
  }
147
- return [2, { data: data, formData: params }];
196
+ _j.label = 8;
197
+ case 8: return [2, {
198
+ data: data,
199
+ boardResponse: {
200
+ user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
201
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
202
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
203
+ entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
204
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
205
+ name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
206
+ contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
207
+ flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info
208
+ },
209
+ formData: params
210
+ }];
148
211
  }
149
212
  });
150
213
  }); });
@@ -157,40 +220,85 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
157
220
  case 1:
158
221
  data = _c.sent();
159
222
  return [2, {
160
- 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 })
223
+ 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 })
161
224
  }];
162
225
  }
163
226
  });
164
227
  }); });
165
- export var updateEntityInfo = createAsyncThunk('updateEntityInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
166
- var _a, settings, entity, requestBody, data;
167
- var _b, _c, _d, _e, _f;
168
- return __generator(this, function (_g) {
169
- switch (_g.label) {
228
+ export var updateEntity = createAsyncThunk('entityUpdateEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
229
+ var _a, settings, entity, id, brandId, articleId, requestBody, brandData, payload, data;
230
+ var _b, _c, _d, _e, _f, _g, _h;
231
+ return __generator(this, function (_j) {
232
+ switch (_j.label) {
170
233
  case 0:
171
234
  _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
235
+ id = (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
236
+ brandId = (_e = (_d = entity.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
237
+ articleId = entity.data.entityData.articleId;
172
238
  requestBody = {
173
- id: (_c = (_b = entity.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id,
174
- activities: (_d = (params.activities || [])) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
175
- var en = _a.en;
176
- return en;
239
+ id: brandId,
240
+ activities: (_f = (params.activities || [])) === null || _f === void 0 ? void 0 : _f.map(function (_a) {
241
+ var id = _a.id;
242
+ return ({ id: id });
177
243
  }),
178
- license_name: params.licenseName,
179
- license_number: params.licenseNumber,
180
- business_operation_start_at: params.operationStartDate,
181
- step_name: ENTITY_STEP_NAMES.ENTITY_INFO
244
+ operations: {
245
+ start_date: params.operationStartDate
246
+ },
247
+ encryption_contract: ['operations.start_date']
182
248
  };
183
- return [4, API.entityService.updateEntityInfo(requestBody)];
249
+ return [4, API.brandService.updateBrandInfo(requestBody)];
184
250
  case 1:
185
- data = (_g.sent()).data;
186
- if (!data.errors) {
187
- thunkApi.dispatch(handleNextScreenStep());
188
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
189
- }
190
- return [2, { data: data, formData: params }];
251
+ brandData = (_j.sent()).data;
252
+ payload = {
253
+ id: id,
254
+ license: {
255
+ number: params.licenseNumber
256
+ },
257
+ legal_name: {
258
+ ar: params.licenseName,
259
+ en: params.licenseName
260
+ },
261
+ AOA_file_id: articleId,
262
+ encryption_contract: ['license.number', 'legal_name.ar', 'legal_name.en']
263
+ };
264
+ return [4, API.entityService.updateEntity(payload)];
265
+ case 2:
266
+ data = _j.sent();
267
+ thunkApi.dispatch(handleNextScreenStep());
268
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
269
+ return [2, { data: __assign(__assign({}, data), brandData), formData: params }];
191
270
  }
192
271
  });
193
272
  }); });
273
+ export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
274
+ var file = _a.file, onProgress = _a.onProgress;
275
+ return __awaiter(void 0, void 0, void 0, function () {
276
+ var typeArray, type, uploadPayload, onUploadProgress, data;
277
+ var _b;
278
+ return __generator(this, function (_c) {
279
+ switch (_c.label) {
280
+ case 0:
281
+ typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
282
+ type = typeArray[1] || '';
283
+ uploadPayload = {
284
+ file_link_create: true,
285
+ title: file === null || file === void 0 ? void 0 : file.name,
286
+ purpose: 'identity_document',
287
+ type: type,
288
+ file: file
289
+ };
290
+ onUploadProgress = function (progressEvent) {
291
+ var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
292
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
293
+ };
294
+ return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
295
+ case 1:
296
+ data = _c.sent();
297
+ return [2, { data: data }];
298
+ }
299
+ });
300
+ });
301
+ });
194
302
  export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
195
303
  var _a, settings, entity, _b, id, infoId, payload, data;
196
304
  var _c, _d, _e, _f;
@@ -215,18 +323,7 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', fun
215
323
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
216
324
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
217
325
  thunkApi.dispatch(handleNextScreenStep());
218
- return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat(data === null || data === void 0 ? void 0 : data.info) }), formData: params }];
219
- }
220
- });
221
- }); });
222
- export var retrieveChannels = createAsyncThunk('retrieveChannelsEntity', function () { return __awaiter(void 0, void 0, void 0, function () {
223
- var data;
224
- return __generator(this, function (_a) {
225
- switch (_a.label) {
226
- case 0: return [4, API.dataService.getChannelsOfServices()];
227
- case 1:
228
- data = (_a.sent()).data;
229
- return [2, data];
326
+ return [2, { response: __assign(__assign({}, data), { flows: data === null || data === void 0 ? void 0 : data.info }), formData: params }];
230
327
  }
231
328
  });
232
329
  }); });
@@ -234,6 +331,7 @@ var initialState = {
234
331
  error: null,
235
332
  loading: false,
236
333
  customLoading: false,
334
+ uploading: false,
237
335
  data: {
238
336
  flowName: FlowsTypes.ENTITY,
239
337
  verify: {
@@ -243,9 +341,11 @@ var initialState = {
243
341
  otp: ''
244
342
  },
245
343
  entityData: {
344
+ licenseName: '',
345
+ licenseNumber: '',
246
346
  activities: [],
247
- salesChannels: [],
248
- operationStartDate: '1998-08-22'
347
+ operationStartDate: '',
348
+ uploading: false
249
349
  }
250
350
  }
251
351
  };
@@ -270,51 +370,37 @@ export var entitySlice = createSlice({
270
370
  state.customLoading = true;
271
371
  })
272
372
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
273
- var _a, _b, _c;
373
+ var _a, _b, _c, _d;
274
374
  state.error = null;
275
375
  state.customLoading = false;
276
- var _d = action.payload, data = _d.data, token = _d.token, boardResponse = _d.boardResponse;
376
+ var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse;
277
377
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
278
378
  if (description) {
279
379
  state.error = description;
280
380
  return;
281
381
  }
282
- var _e = state.data.verify.responseBody || {}, brand = _e.brand, entity = _e.entity;
283
- var issuingDate = brand === null || brand === void 0 ? void 0 : brand.business_operation_start_at;
284
- if (!!issuingDate) {
285
- var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
286
- state.data.entityData.operationStartDate = convertNumbers2English(formattedDate);
287
- }
288
- var channels = (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.channelList;
289
- var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
290
- var _f = brand || {}, website = _f.website, social = _f.social;
291
- var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
292
- var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
293
- var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
294
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
295
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
296
- if (isHasWebsite && (isHasTwitter || isHasInstagram))
297
- selectedChannels = [websiteData, socialData];
298
- else if (isHasTwitter || isHasInstagram)
299
- selectedChannels = [socialData];
300
- else if (isHasWebsite)
301
- selectedChannels = [websiteData];
302
- if (((_c = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _c === void 0 ? void 0 : _c.length) > 0) {
303
- selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
304
- var _a;
305
- return (_a = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
306
- });
382
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
383
+ state.data.verify.token = token;
384
+ var _f = boardResponse || {}, brand = _f.brand, entity = _f.entity;
385
+ var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
386
+ var entityDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
387
+ var startDate = (_d = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _d === void 0 ? void 0 : _d.start_date;
388
+ var issuingDate = undefined;
389
+ if (entityDate) {
390
+ var date = new Date(entityDate);
391
+ var formattedDate = moment(date).format('YYYY-MM-DD');
392
+ issuingDate = convertNumbers2English(formattedDate);
307
393
  }
308
- state.data.entityData.salesChannels = selectedChannels;
394
+ if (licenseNumber)
395
+ state.data.entityData.licenseNumber = licenseNumber;
309
396
  var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
310
397
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
311
398
  var _a;
312
- return (_a = brand === null || brand === void 0 ? void 0 : brand.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(); });
399
+ return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
313
400
  });
314
- state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
315
- state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]] });
316
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
317
- state.data.verify.token = token;
401
+ var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
402
+ state.data.entityData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities;
403
+ state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, operationStartDate: startDate || issuingDate, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities });
318
404
  })
319
405
  .addCase(verifyLeadToken.rejected, function (state, action) {
320
406
  state.error = action.error.message;
@@ -342,10 +428,10 @@ export var entitySlice = createSlice({
342
428
  state.error = null;
343
429
  })
344
430
  .addCase(verifyEntityLeadOTP.fulfilled, function (state, action) {
345
- var _a;
431
+ var _a, _b, _c, _d;
346
432
  state.loading = false;
347
433
  state.error = null;
348
- var _b = action.payload, data = _b.data, formData = _b.formData;
434
+ var _e = action.payload, data = _e.data, boardResponse = _e.boardResponse, formData = _e.formData;
349
435
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
350
436
  if (description) {
351
437
  state.error = description;
@@ -353,16 +439,36 @@ export var entitySlice = createSlice({
353
439
  }
354
440
  state.data.otpData = formData;
355
441
  state.data.otpData.responseBody = data;
442
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
443
+ var _f = boardResponse || {}, brand = _f.brand, entity = _f.entity;
444
+ var licenseNumber = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
445
+ var entityDate = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
446
+ var startDate = (_d = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _d === void 0 ? void 0 : _d.start_date;
447
+ var issuingDate = undefined;
448
+ if (entityDate) {
449
+ var date = new Date(entityDate);
450
+ var formattedDate = moment(date).format('YYYY-MM-DD');
451
+ issuingDate = convertNumbers2English(formattedDate);
452
+ }
453
+ if (licenseNumber)
454
+ state.data.entityData.licenseNumber = licenseNumber;
455
+ var activities = (entity === null || entity === void 0 ? void 0 : entity.activities) || [];
456
+ var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
457
+ var _a;
458
+ return (_a = brand === null || brand === void 0 ? void 0 : brand.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
459
+ });
460
+ var defaultActivities = (activities === null || activities === void 0 ? void 0 : activities.length) ? [activities[0]] : [];
461
+ state.data.entityData.responseBody = __assign(__assign({}, state.data.entityData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities, selectedActivities: (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : defaultActivities, operationStartDate: startDate || issuingDate });
356
462
  })
357
463
  .addCase(verifyEntityLeadOTP.rejected, function (state, action) {
358
464
  state.loading = false;
359
465
  state.error = action.error.message;
360
466
  })
361
- .addCase(updateEntityInfo.pending, function (state) {
467
+ .addCase(updateEntity.pending, function (state) {
362
468
  state.loading = true;
363
469
  state.error = null;
364
470
  })
365
- .addCase(updateEntityInfo.fulfilled, function (state, action) {
471
+ .addCase(updateEntity.fulfilled, function (state, action) {
366
472
  var _a;
367
473
  state.loading = false;
368
474
  state.error = null;
@@ -375,7 +481,7 @@ export var entitySlice = createSlice({
375
481
  state.data.entityData = formData;
376
482
  state.data.entityData.responseBody = data;
377
483
  })
378
- .addCase(updateEntityInfo.rejected, function (state, action) {
484
+ .addCase(updateEntity.rejected, function (state, action) {
379
485
  state.loading = false;
380
486
  state.error = action.error.message;
381
487
  })
@@ -414,41 +520,19 @@ export var entitySlice = createSlice({
414
520
  state.loading = false;
415
521
  state.error = action.error.message;
416
522
  })
417
- .addCase(retrieveChannels.pending, function (state) {
523
+ .addCase(uploadArticle.pending, function (state) {
418
524
  state.error = null;
419
- state.loading = true;
525
+ state.uploading = true;
420
526
  })
421
- .addCase(retrieveChannels.fulfilled, function (state, action) {
422
- var _a;
527
+ .addCase(uploadArticle.fulfilled, function (state, action) {
423
528
  state.error = null;
424
- state.loading = false;
425
- var data = action.payload || {};
426
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
427
- if (description) {
428
- state.error = description;
429
- return;
430
- }
431
- var channels = data || [];
432
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { channelList: channels });
433
- var brand = (state.data.verify.responseBody || {}).brand;
434
- var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
435
- var _b = brand || {}, website = _b.website, social = _b.social;
436
- var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
437
- var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
438
- var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
439
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
440
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
441
- if (isHasWebsite && (isHasTwitter || isHasInstagram))
442
- selectedChannels = [websiteData, socialData];
443
- else if (isHasTwitter || isHasInstagram)
444
- selectedChannels = [socialData];
445
- else if (isHasWebsite)
446
- selectedChannels = [websiteData];
447
- state.data.entityData.salesChannels = selectedChannels;
529
+ state.uploading = false;
530
+ var data = action.payload.data;
531
+ state.data.entityData.articleId = data === null || data === void 0 ? void 0 : data.id;
448
532
  })
449
- .addCase(retrieveChannels.rejected, function (state, action) {
450
- state.error = action.error.message;
451
- state.loading = false;
533
+ .addCase(uploadArticle.rejected, function (state) {
534
+ state.uploading = false;
535
+ state.error = 'file_upload_error';
452
536
  });
453
537
  }
454
538
  });
@@ -12,6 +12,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
12
12
  contact: any;
13
13
  countries: CountryCode[];
14
14
  countryCode: any;
15
+ notification: any;
15
16
  flows: {
16
17
  name: string;
17
18
  status: string;
@@ -33,6 +34,23 @@ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk
33
34
  }, string, {}>;
34
35
  export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
35
36
  data: any;
37
+ boardResponse: {
38
+ user: any;
39
+ brand: any;
40
+ bank_account: any;
41
+ entity: any;
42
+ merchant: any;
43
+ name: any;
44
+ contact: any;
45
+ countries: CountryCode[];
46
+ countryCode: any;
47
+ notification: any;
48
+ flows: {
49
+ name: string;
50
+ status: string;
51
+ url: string;
52
+ }[];
53
+ };
36
54
  formData: {
37
55
  otp: string;
38
56
  };