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

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 (314) 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 +21 -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 +9 -2
  25. package/build/app/settings.js +22 -11
  26. package/build/app/store.d.ts +0 -2
  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 +5 -3
  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 +5 -5
  62. package/build/constants/app.js +62 -32
  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 +88 -41
  73. package/build/features/app/business/businessStore.d.ts +33 -5
  74. package/build/features/app/business/businessStore.js +487 -350
  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 +40 -8
  78. package/build/features/app/entity/entityStore.js +387 -149
  79. package/build/features/app/individual/individualStore.d.ts +18 -0
  80. package/build/features/app/individual/individualStore.js +168 -89
  81. package/build/features/app/password/passwordStore.d.ts +1 -7
  82. package/build/features/app/password/passwordStore.js +31 -20
  83. package/build/features/app/tax/taxStore.js +23 -16
  84. package/build/features/auth/Auth.d.ts +2 -1
  85. package/build/features/auth/Auth.js +37 -9
  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.js +8 -4
  99. package/build/features/auth/screens/OTP/OTPInput.js +9 -2
  100. package/build/features/bank/Bank.js +4 -4
  101. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
  102. package/build/features/bank/screens/BankDetails/BankName.js +2 -1
  103. package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
  104. package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
  105. package/build/features/bank/screens/BankDetails/IBAN.js +4 -1
  106. package/build/features/bank/screens/BankDetails/validation.js +2 -2
  107. package/build/features/bank/screens/Success/Success.js +7 -3
  108. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -12
  109. package/build/features/business/Business.js +4 -4
  110. package/build/features/business/screens/Activities/Activities.js +16 -17
  111. package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
  112. package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
  113. package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
  114. package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
  115. package/build/features/business/screens/Activities/validation.d.ts +0 -51
  116. package/build/features/business/screens/Activities/validation.js +4 -10
  117. package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
  118. package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
  119. package/build/features/business/screens/BusinessType/EntityName.js +56 -0
  120. package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
  121. package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
  122. package/build/features/business/screens/BusinessType/LicenseList.js +26 -7
  123. package/build/features/business/screens/BusinessType/LicenseNumber.js +12 -6
  124. package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
  125. package/build/features/business/screens/BusinessType/LicenseType.js +78 -0
  126. package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
  127. package/build/features/business/screens/BusinessType/validation.js +52 -3
  128. package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
  129. package/build/features/business/screens/CivilID/CivilID.js +67 -0
  130. package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
  131. package/build/features/business/screens/CivilID/IDNumber.js +59 -0
  132. package/build/features/business/screens/CivilID/index.d.ts +3 -0
  133. package/build/features/business/screens/CivilID/index.js +2 -0
  134. package/build/features/business/screens/CivilID/validation.d.ts +8 -0
  135. package/build/features/business/screens/CivilID/validation.js +4 -0
  136. package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
  137. package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
  138. package/build/features/business/screens/Customers/Customers.js +15 -9
  139. package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
  140. package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
  141. package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
  142. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
  143. package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
  144. package/build/features/business/screens/OTP/OTP.js +15 -2
  145. package/build/features/business/screens/Success/Success.js +10 -3
  146. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -11
  147. package/build/features/business/screens/Verify/Verify.js +4 -4
  148. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  149. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
  150. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  151. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  152. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  153. package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  154. package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
  155. package/build/features/business/screens/VerifyPACI/index.js +2 -0
  156. package/build/features/connect/Connect.d.ts +1 -0
  157. package/build/features/connect/Connect.js +38 -10
  158. package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
  159. package/build/features/connect/screens/CivilID/CivilID.js +102 -0
  160. package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
  161. package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
  162. package/build/features/connect/screens/CivilID/index.d.ts +3 -0
  163. package/build/features/connect/screens/CivilID/index.js +2 -0
  164. package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
  165. package/build/features/connect/screens/CivilID/validation.js +4 -0
  166. package/build/features/connect/screens/Individual/Email.js +11 -3
  167. package/build/features/connect/screens/Individual/Individual.js +44 -28
  168. package/build/features/connect/screens/Merchant/BrandList.js +15 -7
  169. package/build/features/connect/screens/Merchant/BrandName.js +7 -4
  170. package/build/features/connect/screens/Merchant/Merchant.js +48 -65
  171. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +4 -1
  172. package/build/features/connect/screens/Merchant/SalesChannels.js +28 -31
  173. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +3 -4
  174. package/build/features/connect/screens/Merchant/SocialMedia.js +106 -112
  175. package/build/features/connect/screens/Merchant/TAC.js +8 -2
  176. package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
  177. package/build/features/connect/screens/Merchant/validation.js +106 -173
  178. package/build/features/connect/screens/Mobile/Mobile.js +33 -12
  179. package/build/features/connect/screens/NID/NID.js +5 -1
  180. package/build/features/connect/screens/OTP/OTP.js +20 -6
  181. package/build/features/connect/screens/OTP/OTPInput.js +3 -2
  182. package/build/features/connect/screens/ThankYou/ThankYou.js +8 -2
  183. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  184. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
  185. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
  186. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
  187. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
  188. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
  189. package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
  190. package/build/features/connect/screens/VerifyPACI/index.js +2 -0
  191. package/build/features/entity/Entity.js +6 -6
  192. package/build/features/entity/screens/Customers/CustomerLocations.d.ts +118 -0
  193. package/build/features/entity/screens/Customers/CustomerLocations.js +171 -0
  194. package/build/features/entity/screens/Customers/Customers.d.ts +5 -0
  195. package/build/features/entity/screens/Customers/Customers.js +90 -0
  196. package/build/features/entity/screens/Customers/ExpectedCustomers.d.ts +8 -0
  197. package/build/features/entity/screens/Customers/ExpectedCustomers.js +98 -0
  198. package/build/features/entity/screens/Customers/ExpectedSalesRange.d.ts +8 -0
  199. package/build/features/entity/screens/Customers/ExpectedSalesRange.js +127 -0
  200. package/build/features/entity/screens/Customers/RefundPolicy.d.ts +36 -0
  201. package/build/features/entity/screens/Customers/RefundPolicy.js +84 -0
  202. package/build/features/entity/screens/Customers/TransactionPolicy.d.ts +3 -0
  203. package/build/features/entity/screens/Customers/TransactionPolicy.js +44 -0
  204. package/build/features/entity/screens/Customers/index.d.ts +3 -0
  205. package/build/features/entity/screens/Customers/index.js +2 -0
  206. package/build/features/entity/screens/Customers/validation.d.ts +20 -0
  207. package/build/features/entity/screens/Customers/validation.js +13 -0
  208. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +2 -1
  209. package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +25 -15
  210. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
  211. package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
  212. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +38 -10
  213. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
  214. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
  215. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +34 -5
  216. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
  217. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +75 -41
  218. package/build/features/entity/screens/EntityInfoConfirm/validation.js +76 -10
  219. package/build/features/entity/screens/Success/Success.js +7 -3
  220. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -10
  221. package/build/features/entity/screens/Verify/Verify.js +18 -5
  222. package/build/features/featuresScreens.d.ts +0 -1
  223. package/build/features/featuresScreens.js +30 -7
  224. package/build/features/individual/Individual.js +4 -4
  225. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
  226. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
  227. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
  228. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
  229. package/build/features/individual/screens/Success/Success.js +7 -3
  230. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -12
  231. package/build/features/individual/screens/Verify/Verify.js +18 -5
  232. package/build/features/password/Password.js +4 -4
  233. package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
  234. package/build/features/password/screens/OTP/OTP.js +15 -2
  235. package/build/features/password/screens/Success/Success.js +7 -3
  236. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -13
  237. package/build/features/password/screens/Verify/Verify.js +16 -3
  238. package/build/features/shared/Background/Background.d.ts +2 -5
  239. package/build/features/shared/Background/Background.js +7 -3
  240. package/build/features/shared/Button/Button.js +1 -0
  241. package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
  242. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  243. package/build/features/shared/Button/MobileButton.d.ts +2 -1
  244. package/build/features/shared/Button/MobileButton.js +2 -2
  245. package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
  246. package/build/features/shared/Dialog/CloseDialog.js +71 -0
  247. package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
  248. package/build/features/shared/Dialog/DialogContainer.js +56 -0
  249. package/build/features/shared/Dialog/index.d.ts +4 -0
  250. package/build/features/shared/Dialog/index.js +4 -0
  251. package/build/features/shared/Input/Input.d.ts +1 -1
  252. package/build/features/shared/Input/Input.js +2 -2
  253. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +1 -1
  254. package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -2
  255. package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
  256. package/build/features/shared/UploadFile/UploadFile.js +24 -9
  257. package/build/features/signIn/SignIn.js +4 -4
  258. package/build/features/signIn/screens/Email/Email.js +4 -2
  259. package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
  260. package/build/features/signIn/screens/OTP/OTP.js +14 -1
  261. package/build/features/signIn/screens/Password/Password.js +15 -2
  262. package/build/features/tax/Tax.js +6 -6
  263. package/build/features/tax/screens/Success/Success.js +9 -3
  264. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
  265. package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
  266. package/build/features/tax/screens/Verify/Verify.js +16 -3
  267. package/build/hooks/index.d.ts +2 -0
  268. package/build/hooks/index.js +2 -0
  269. package/build/hooks/useAppConfig.d.ts +3 -1
  270. package/build/hooks/useAppConfig.js +2 -2
  271. package/build/hooks/useAppDispatch.d.ts +0 -1
  272. package/build/hooks/useErrorListener.js +0 -6
  273. package/build/hooks/useScreen.d.ts +3 -0
  274. package/build/hooks/useScreen.js +14 -0
  275. package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
  276. package/build/hooks/useSetFromDefaultValues.js +24 -0
  277. package/build/index.d.ts +2 -3
  278. package/build/index.js +1 -4
  279. package/build/utils/array.d.ts +50 -1
  280. package/build/utils/array.js +66 -0
  281. package/build/utils/common.d.ts +1 -0
  282. package/build/utils/common.js +3 -0
  283. package/build/utils/date.d.ts +1 -0
  284. package/build/utils/date.js +5 -0
  285. package/build/utils/device.d.ts +1 -0
  286. package/build/utils/device.js +13 -0
  287. package/build/utils/index.d.ts +2 -0
  288. package/build/utils/index.js +2 -0
  289. package/build/utils/locale.js +1 -1
  290. package/build/utils/object.d.ts +1 -0
  291. package/build/utils/object.js +12 -0
  292. package/build/utils/string.d.ts +14 -0
  293. package/build/utils/string.js +85 -3
  294. package/build/utils/validation.d.ts +2 -0
  295. package/build/utils/validation.js +6 -0
  296. package/package.json +4 -3
  297. package/build/features/app/otp/otpStore.d.ts +0 -28
  298. package/build/features/app/otp/otpStore.js +0 -153
  299. package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
  300. package/build/features/business/screens/Activities/SalesChannels.js +0 -112
  301. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
  302. package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
  303. package/build/features/otp/OTP.d.ts +0 -7
  304. package/build/features/otp/OTP.js +0 -58
  305. package/build/features/otp/index.d.ts +0 -0
  306. package/build/features/otp/index.js +0 -1
  307. package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
  308. package/build/features/otp/screens/OTPVerify/OTPInput.js +0 -47
  309. package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
  310. package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
  311. package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
  312. package/build/features/otp/screens/OTPVerify/index.js +0 -2
  313. package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
  314. package/build/features/otp/screens/OTPVerify/validation.js +0 -4
@@ -2,3 +2,4 @@ import { DeviceDetectorResult } from 'device-detector-js';
2
2
  import { GetResult } from '@fingerprintjs/fingerprintjs';
3
3
  export declare const getBrowserInfo: () => DeviceDetectorResult;
4
4
  export declare const getFingerPrint: () => Promise<GetResult>;
5
+ export declare const mobileOS: () => 'Windows Phone' | 'Android' | 'iOS' | 'unknown';
@@ -11,3 +11,16 @@ export var getFingerPrint = function () {
11
11
  });
12
12
  });
13
13
  };
14
+ export var mobileOS = function () {
15
+ var userAgent = navigator.userAgent || navigator.vendor || window.opera;
16
+ if (/windows phone/i.test(userAgent)) {
17
+ return 'Windows Phone';
18
+ }
19
+ if (/android/i.test(userAgent)) {
20
+ return 'Android';
21
+ }
22
+ if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
23
+ return 'iOS';
24
+ }
25
+ return 'unknown';
26
+ };
@@ -7,3 +7,5 @@ export * from './validation';
7
7
  export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
+ export * from './common';
11
+ export * from './date';
@@ -7,3 +7,5 @@ export * from './validation';
7
7
  export * from './string';
8
8
  export * from './device';
9
9
  export * from './rsa';
10
+ export * from './common';
11
+ export * from './date';
@@ -1,7 +1,7 @@
1
1
  import { initReactI18next } from 'react-i18next';
2
2
  import i18n from '../i18n';
3
3
  export var updateLocale = function (locale, country) {
4
- var data = locale[country.toUpperCase()] || locale['default'];
4
+ var data = locale['SA'] || locale[country.toUpperCase()] || locale['default'];
5
5
  if (i18n.isInitialized) {
6
6
  i18n.removeResourceBundle('*', 'translation');
7
7
  i18n.addResourceBundle('en', 'translation', data.en.translation);
@@ -2,3 +2,4 @@ export declare const compareTwoObjects: (obj1: any, obj2: any) => boolean;
2
2
  export declare const encodeObjectBase64: (obj: any) => string;
3
3
  export declare const decodeObjectBase64: (str: string) => any;
4
4
  export declare const hasKey: (obj: any, key: string) => boolean;
5
+ export declare const concatenateObjectValues: (data: Record<string, any>, keys: Array<string>) => string;
@@ -21,3 +21,15 @@ export var hasKey = function (obj, key) {
21
21
  return false;
22
22
  return Object.keys(obj).includes(key);
23
23
  };
24
+ export var concatenateObjectValues = function (data, keys) {
25
+ if (!data)
26
+ return '';
27
+ var result = '';
28
+ for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
29
+ var key = keys_1[_i];
30
+ if (data[key]) {
31
+ result += data[key].trim() + ' ';
32
+ }
33
+ }
34
+ return result.trim();
35
+ };
@@ -1,8 +1,10 @@
1
1
  import { DeviceInfo } from '../@types';
2
2
  export declare const maskPhone: (str?: string) => string;
3
+ export declare const shortenBankName: (str: string) => string;
3
4
  export declare const maskID: (str: string) => string;
4
5
  export declare const maskEmail: (str: string) => string;
5
6
  export declare const showLastFour: (str: string) => string;
7
+ export declare const maskFileName: (str: string) => string;
6
8
  export declare const getIndividualName: (name: string) => {
7
9
  first: string;
8
10
  middle: string;
@@ -41,3 +43,15 @@ export declare const removeRequestHeaders: () => void;
41
43
  export declare const getBaseUrl: () => string;
42
44
  export declare const getScreenNameBasedOnFlow: (flow: string) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP";
43
45
  export declare const getEighteenYearsAgo: () => string;
46
+ export declare const isKW: (flag: string) => boolean;
47
+ export declare const isSA: (flag: string) => boolean;
48
+ export declare const isLinkedIn: (flag: string) => boolean;
49
+ export declare const isTwitter: (flag: string) => boolean;
50
+ export declare const isWebsite: (flag: string) => boolean;
51
+ export declare const isIos: (flag: string) => boolean;
52
+ export declare const isAndroid: (flag: string) => boolean;
53
+ export declare const isFacebook: (flag: string) => boolean;
54
+ export declare const isInstagram: (flag: string) => boolean;
55
+ export declare const isPhysicalStore: (flag: string) => boolean;
56
+ export declare const isCallCenter: (flag: string) => boolean;
57
+ export declare const getChannelIcon: (channel: string) => string;
@@ -1,20 +1,32 @@
1
1
  import { FlowsTypes } from '../@types';
2
2
  import { encryptString } from '.';
3
3
  import { removeAxiosGlobalHeaders } from '../api';
4
- import { ENDPOINT_PATHS } from '../constants';
4
+ import { ENDPOINT_PATHS, ICONS_FULL_PATH } from '../constants';
5
5
  import moment from 'moment';
6
6
  export var maskPhone = function (str) {
7
7
  if (str === void 0) { str = ''; }
8
8
  var lastTwo = str.substring(str.length - 2, str.length);
9
9
  return ' ••••' + lastTwo;
10
10
  };
11
+ export var shortenBankName = function (str) {
12
+ if (str)
13
+ return str.slice(0, 20);
14
+ return '';
15
+ };
11
16
  export var maskID = function (str) {
12
17
  var lastTwo = str.substring(str.length - 2, str.length);
13
18
  return ' ••••' + lastTwo;
14
19
  };
15
20
  export var maskEmail = function (str) {
16
- var lastTwo = str.substring(str.length - 2, str.length);
17
- return ' ••••' + lastTwo;
21
+ if (str) {
22
+ var name_1 = str.split('@')[0];
23
+ var maskedName = name_1[0] + '*' + name_1[name_1.length - 1];
24
+ var domain = str.split('@')[1].split('.')[0];
25
+ var maskedDomain = '@' + domain[0] + '*' + domain[domain.length - 1];
26
+ var TLD = '.' + str.split('@')[1].split('.')[1];
27
+ return maskedName + maskedDomain + TLD;
28
+ }
29
+ return '';
18
30
  };
19
31
  export var showLastFour = function (str) {
20
32
  if (str && str.length >= 4) {
@@ -23,6 +35,12 @@ export var showLastFour = function (str) {
23
35
  }
24
36
  return str;
25
37
  };
38
+ export var maskFileName = function (str) {
39
+ if (str.length < 28)
40
+ return str;
41
+ var first = str.substring(0, 28);
42
+ return first + '....';
43
+ };
26
44
  export var getIndividualName = function (name) {
27
45
  var _a;
28
46
  var nameArray = (name === null || name === void 0 ? void 0 : name.split(' ')) || [];
@@ -167,3 +185,67 @@ export var getEighteenYearsAgo = function () {
167
185
  var eighteenYearsAgo = new Date();
168
186
  return moment(eighteenYearsAgo.setFullYear(eighteenYearsAgo.getFullYear() - 18)).format('YYYY-MM-DD');
169
187
  };
188
+ export var isKW = function (flag) {
189
+ return ['kw', 'kwd'].includes(flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
190
+ };
191
+ export var isSA = function (flag) {
192
+ return ['sa', 'sau'].includes(flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
193
+ };
194
+ export var isLinkedIn = function (flag) {
195
+ return 'linkedin' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
196
+ };
197
+ export var isTwitter = function (flag) {
198
+ return 'twitter' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
199
+ };
200
+ export var isWebsite = function (flag) {
201
+ return 'website' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
202
+ };
203
+ export var isIos = function (flag) {
204
+ return 'ios' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
205
+ };
206
+ export var isAndroid = function (flag) {
207
+ return 'android' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
208
+ };
209
+ export var isFacebook = function (flag) {
210
+ return 'facebook' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
211
+ };
212
+ export var isInstagram = function (flag) {
213
+ return 'instagram' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
214
+ };
215
+ export var isPhysicalStore = function (flag) {
216
+ return 'physical_store' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
217
+ };
218
+ export var isCallCenter = function (flag) {
219
+ return 'call_center' === (flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
220
+ };
221
+ export var getChannelIcon = function (channel) {
222
+ var key = channel === null || channel === void 0 ? void 0 : channel.toLowerCase();
223
+ if (isWebsite(key)) {
224
+ return ICONS_FULL_PATH + '/website.svg';
225
+ }
226
+ if (isLinkedIn(key)) {
227
+ return ICONS_FULL_PATH + '/LinkedIn-white.png';
228
+ }
229
+ if (isFacebook(key)) {
230
+ return ICONS_FULL_PATH + '/facebook.svg';
231
+ }
232
+ if (isInstagram(key)) {
233
+ return ICONS_FULL_PATH + '/insta.svg';
234
+ }
235
+ if (isTwitter(key)) {
236
+ return ICONS_FULL_PATH + '/twitter-icon.svg';
237
+ }
238
+ if (isPhysicalStore(key)) {
239
+ return ICONS_FULL_PATH + '/physical-store.svg';
240
+ }
241
+ if (isIos(key)) {
242
+ return ICONS_FULL_PATH + '/apple.svg';
243
+ }
244
+ if (isAndroid(key)) {
245
+ return ICONS_FULL_PATH + '/play-store.svgg';
246
+ }
247
+ if (isCallCenter(key)) {
248
+ return ICONS_FULL_PATH + '/call-center.svg';
249
+ }
250
+ return '';
251
+ };
@@ -13,3 +13,5 @@ export declare function isPasswordHasLowerLetter(password: string): boolean;
13
13
  export declare function isPasswordHasSpecialLetter(password: string): boolean;
14
14
  export declare const keepLettersAndSpace: (str: string) => string;
15
15
  export declare const isTapDomain: (domain: string) => boolean;
16
+ export declare const removeArabicWords: (str: string) => string;
17
+ export declare const removeAllOtherThanArabicWords: (str: string) => string;
@@ -43,3 +43,9 @@ export var keepLettersAndSpace = function (str) {
43
43
  export var isTapDomain = function (domain) {
44
44
  return domain.includes('tap.company');
45
45
  };
46
+ export var removeArabicWords = function (str) {
47
+ return str.replace(/[\u0600-\u06FF]/g, '').trim();
48
+ };
49
+ export var removeAllOtherThanArabicWords = function (str) {
50
+ return str.replace(/[^ء-ي]/g, '');
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.43-test",
3
+ "version": "2.0.43",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -35,7 +35,6 @@
35
35
  "@babel/preset-react": "^7.18.6",
36
36
  "@babel/preset-typescript": "^7.18.6",
37
37
  "@types/lodash-es": "^4.17.6",
38
- "@types/moment-hijri": "^2.1.0",
39
38
  "@types/react": "^18.0.15",
40
39
  "@types/react-calendar": "~3.5.1",
41
40
  "@types/react-dom": "^18.0.6",
@@ -89,7 +88,8 @@
89
88
  "i18next-http-backend": "^1.4.1",
90
89
  "jsencrypt": "^2.3.1",
91
90
  "lodash-es": "^4.17.21",
92
- "moment-hijri": "~2.1.2",
91
+ "lottie-web": "^5.9.6",
92
+ "moment": "^2.29.4",
93
93
  "react": "^18.2.0",
94
94
  "react-calendar": "~3.7.0",
95
95
  "react-device-detect": "^2.2.2",
@@ -97,6 +97,7 @@
97
97
  "react-dropzone": "^14.2.2",
98
98
  "react-hook-form": "^7.33.1",
99
99
  "react-i18next": "^11.18.1",
100
+ "react-multi-date-picker": "^3.3.4",
100
101
  "react-otp-input": "^2.4.0",
101
102
  "react-redux": "^8.0.2",
102
103
  "react-spring-bottom-sheet": "^3.4.1",
@@ -1,28 +0,0 @@
1
- import { RootState } from '../../../app/store';
2
- import { FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
- export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
4
- data: any;
5
- }, void, {}>;
6
- export declare const verifyOtpLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
7
- formData: OTPFormValues;
8
- }, OTPFormValues, {}>;
9
- declare type VerifyData = {
10
- token: string;
11
- };
12
- export interface OtpData {
13
- verify: ResponseData & VerifyData;
14
- otpData: OTPFormValues & ResponseData;
15
- flowName: FlowsTypes;
16
- }
17
- export interface OtpState extends SharedState<OtpData> {
18
- customLoading?: boolean;
19
- }
20
- export declare const otpSlice: import("@reduxjs/toolkit").Slice<OtpState, {
21
- clearError: (state: OtpState) => void;
22
- stopLoader: (state: OtpState) => void;
23
- resetOTPScreen: (state: OtpState) => void;
24
- }, "otp/store">;
25
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
26
- declare const _default: import("redux").Reducer<OtpState, import("redux").AnyAction>;
27
- export default _default;
28
- export declare const otpSelector: (state: RootState) => OtpState;
@@ -1,153 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- var _a;
49
- import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import API from '../../../api';
51
- import { FlowsTypes } from '../../../@types';
52
- import { handleNextScreenStep } from '../../../app/settings';
53
- import { OTP_STEP_NAMES } from '../../../constants';
54
- export var resendOTP = createAsyncThunk('otpResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var otp, payload, data;
56
- return __generator(this, function (_a) {
57
- switch (_a.label) {
58
- case 0:
59
- otp = thunkApi.getState().otp;
60
- payload = {
61
- service_name: 'tap_email',
62
- verify_token: otp.data.verify.token
63
- };
64
- return [4, API.leadService.verifyLeadToken(payload)];
65
- case 1:
66
- data = (_a.sent()).data;
67
- return [2, { data: data }];
68
- }
69
- });
70
- }); });
71
- export var verifyOtpLeadOTP = createAsyncThunk('verifyOtpLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
72
- var otp, responseBody, payload;
73
- var _a;
74
- return __generator(this, function (_b) {
75
- otp = thunkApi.getState().otp;
76
- responseBody = otp.data.verify.responseBody;
77
- payload = {
78
- data: params.otp,
79
- service_name: (_a = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _a === void 0 ? void 0 : _a.service_name,
80
- verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
81
- step_name: OTP_STEP_NAMES.PHONE_AUTH,
82
- encryption_contract: ['data']
83
- };
84
- thunkApi.dispatch(handleNextScreenStep());
85
- return [2, { formData: params }];
86
- });
87
- }); });
88
- var initialState = {
89
- error: null,
90
- loading: false,
91
- customLoading: false,
92
- data: {
93
- flowName: FlowsTypes.OTP,
94
- verify: {
95
- token: ''
96
- },
97
- otpData: {
98
- otp: ''
99
- }
100
- }
101
- };
102
- export var otpSlice = createSlice({
103
- name: 'otp/store',
104
- initialState: initialState,
105
- reducers: {
106
- clearError: function (state) {
107
- state.error = null;
108
- },
109
- stopLoader: function (state) {
110
- state.loading = false;
111
- },
112
- resetOTPScreen: function (state) {
113
- state.data.otpData.otp = '';
114
- }
115
- },
116
- extraReducers: function (builder) {
117
- builder
118
- .addCase(resendOTP.pending, function (state) {
119
- state.error = null;
120
- })
121
- .addCase(resendOTP.fulfilled, function (state, action) {
122
- var _a;
123
- state.error = null;
124
- var data = action.payload.data;
125
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
126
- if (description) {
127
- state.error = description;
128
- return;
129
- }
130
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
131
- })
132
- .addCase(resendOTP.rejected, function (state, action) {
133
- state.error = action.error.message;
134
- })
135
- .addCase(verifyOtpLeadOTP.pending, function (state) {
136
- state.loading = true;
137
- state.error = null;
138
- })
139
- .addCase(verifyOtpLeadOTP.fulfilled, function (state, action) {
140
- state.loading = false;
141
- state.error = null;
142
- var formData = action.payload.formData;
143
- state.data.otpData = formData;
144
- })
145
- .addCase(verifyOtpLeadOTP.rejected, function (state, action) {
146
- state.loading = false;
147
- state.error = action.error.message;
148
- });
149
- }
150
- });
151
- export var clearError = (_a = otpSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
152
- export default otpSlice.reducer;
153
- export var otpSelector = function (state) { return state.otp; };
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
- export declare const CollapseStyled: import("@emotion/styled").StyledComponent<import("../../../../components/Collapse").CollapseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
4
- declare const SalesChannels: () => JSX.Element;
5
- export default SalesChannels;
@@ -1,112 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
- if (ar || !(i in from)) {
15
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
- ar[i] = from[i];
17
- }
18
- }
19
- return to.concat(ar || Array.prototype.slice.call(from));
20
- };
21
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
- import * as React from 'react';
23
- import Box from '@mui/material/Box';
24
- import { alpha, styled } from '@mui/material/styles';
25
- import { useTranslation } from 'react-i18next';
26
- import { useController, useFormContext } from 'react-hook-form';
27
- import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
28
- import Text from '../../../../components/Text';
29
- import { businessSelector, clearError } from '../../../app/business/businessStore';
30
- import CheckBox from '../../../../components/CheckBox';
31
- import Warning from '../../../../components/Warning';
32
- import Collapse from '../../../../components/Collapse';
33
- import { ScreenContainer } from '../../../shared/Containers';
34
- var InputLabelStyled = styled(Text)(function (_a) {
35
- var theme = _a.theme;
36
- return (__assign({ margin: theme.spacing(2.5, 2.5, 0.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
37
- });
38
- var ContainerStyled = styled(Box)(function (_a) {
39
- var theme = _a.theme;
40
- return ({
41
- display: 'flex',
42
- flexDirection: 'row',
43
- alignItems: 'center',
44
- padding: theme.spacing(0, 0.5, 0, 0.5),
45
- height: theme.spacing(3.625),
46
- marginBlockEnd: theme.spacing(0.2)
47
- });
48
- });
49
- var TextStyled = styled(Text)(function (_a) {
50
- var theme = _a.theme;
51
- return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre' }, theme.typography.body2), { marginBlockStart: theme.spacing(1.75) }));
52
- });
53
- var CheckBoxStyled = styled(CheckBox)(function (_a) {
54
- var theme = _a.theme;
55
- return ({
56
- marginInlineEnd: theme.spacing(-1),
57
- '& .MuiSvgIcon-root': {
58
- fontSize: 30
59
- },
60
- '&.Mui-checked': {
61
- color: theme.palette.text.primary,
62
- borderRadius: theme.spacing(2.5)
63
- }
64
- });
65
- });
66
- export var MandatoryStyled = styled('span')(function (_a) {
67
- var theme = _a.theme;
68
- return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
69
- });
70
- export var CollapseStyled = styled(Collapse)(function (_a) {
71
- var theme = _a.theme;
72
- return ({
73
- marginBlockStart: theme.spacing(2)
74
- });
75
- });
76
- var SalesChannels = function () {
77
- var _a;
78
- var _b = React.useState([]), channelsMenuList = _b[0], setChannelsMenuList = _b[1];
79
- var t = useTranslation().t;
80
- var isAr = useLanguage().isAr;
81
- var control = useFormContext().control;
82
- var dispatch = useAppDispatch();
83
- var channelsControl = useController({ name: 'salesChannels', control: control });
84
- var channelsChecked = channelsControl.field.value;
85
- var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
86
- var _c = useAppSelector(businessSelector), data = _c.data, error = _c.error;
87
- var channelList = (data.businessTypeData.responseBody || {}).channelList;
88
- var salesChannels = (data.activitiesData || {}).salesChannels;
89
- React.useEffect(function () {
90
- if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
91
- setChannelsMenuList(channelList);
92
- }
93
- }, [channelList]);
94
- var handleSalesChannelChange = function (event, checked) {
95
- var selected = channelsMenuList.find(function (channel) { return channel.id === event.target.id; });
96
- var isExists = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (selected === null || selected === void 0 ? void 0 : selected.id); });
97
- if (isExists) {
98
- var updatedIdList = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.filter(function (channel) { return channel.id !== (selected === null || selected === void 0 ? void 0 : selected.id); });
99
- channelsControl.field.onChange(updatedIdList);
100
- return;
101
- }
102
- channelsControl.field.onChange(__spreadArray(__spreadArray([], channelsChecked, true), [selected], false));
103
- if (error)
104
- dispatch(clearError());
105
- };
106
- var getSelectedChannelsFlag = function (item) {
107
- if (channelsChecked)
108
- return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
109
- };
110
- return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name_ar : channel.name_en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
111
- };
112
- export default SalesChannels;
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
- export declare const CollapseStyled: import("@emotion/styled").StyledComponent<import("../../../../components/Collapse").CollapseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
4
- declare const SalesChannels: () => JSX.Element;
5
- export default SalesChannels;