@truworth/twc-auth 3.0.6 → 3.0.7

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 (377) hide show
  1. package/package.json +1 -2
  2. package/build/assets/animation/redirect-home.json +0 -1101
  3. package/build/assets/cross_icon copy.svg +0 -5
  4. package/build/assets/cross_icon.svg +0 -5
  5. package/build/assets/email_icon.svg +0 -6
  6. package/build/assets/gender-diversity.svg +0 -22
  7. package/build/assets/loading-spinner.json +0 -1
  8. package/build/assets/logo.svg +0 -55
  9. package/build/assets/okay_icon.svg +0 -3
  10. package/build/src/api/auth.js +0 -36
  11. package/build/src/api/axiosClient/index.js +0 -5
  12. package/build/src/api/axiosClient/index.native.js +0 -5
  13. package/build/src/components/AdvancedTransitionWrapper/index.js +0 -374
  14. package/build/src/components/AdvancedTransitionWrapper/index.native.js +0 -10
  15. package/build/src/components/AdvancedTransitionWrapper/types.js +0 -1
  16. package/build/src/components/ConfirmationModal/index.js +0 -11
  17. package/build/src/components/ConfirmationModal/index.native.js +0 -15
  18. package/build/src/components/ConfirmationModal/types.js +0 -1
  19. package/build/src/components/IonIcon/index.js +0 -11
  20. package/build/src/components/IonIcon/index.native.js +0 -9
  21. package/build/src/components/IonIcon/types.js +0 -1
  22. package/build/src/components/LoadingAnimation/index.js +0 -50
  23. package/build/src/components/OTPStatusLabel/index.js +0 -10
  24. package/build/src/components/OTPStatusLabel/index.native.js +0 -21
  25. package/build/src/components/OTPStatusLabel/types.js +0 -1
  26. package/build/src/components/PasswordCriteria/hooks/usePasswordCriteria.js +0 -71
  27. package/build/src/components/PasswordCriteria/index.js +0 -47
  28. package/build/src/components/PasswordCriteria/index.native.js +0 -22
  29. package/build/src/components/PasswordCriteria/types.js +0 -1
  30. package/build/src/components/ScreenLayout/index.js +0 -12
  31. package/build/src/components/ScreenLayout/index.native.js +0 -18
  32. package/build/src/components/ScreenLayout/types.js +0 -1
  33. package/build/src/components/SupportDetails/index.js +0 -9
  34. package/build/src/components/SupportDetails/index.native.js +0 -6
  35. package/build/src/components/VerifyEmailOTP/index.js +0 -20
  36. package/build/src/components/VerifyEmailOTP/index.native.js +0 -22
  37. package/build/src/components/VerifyEmailOTP/types.js +0 -1
  38. package/build/src/components/VerifyMobileOTP/index.js +0 -25
  39. package/build/src/components/VerifyMobileOTP/index.native.js +0 -38
  40. package/build/src/components/VerifyMobileOTP/types.js +0 -1
  41. package/build/src/constants/base-url/index.js +0 -5
  42. package/build/src/constants/base-url/index.native.js +0 -1
  43. package/build/src/constants/cdn-url/index.js +0 -2
  44. package/build/src/constants/cdn-url/index.native.js +0 -5
  45. package/build/src/constants/defaultPolicy.js +0 -9
  46. package/build/src/constants/password-requirements.js +0 -7
  47. package/build/src/constants/social-login-options.js +0 -16
  48. package/build/src/contexts/AuthContext.js +0 -190
  49. package/build/src/contexts/type.js +0 -1
  50. package/build/src/enums/index.js +0 -3
  51. package/build/src/enums/loginMethod.enum.js +0 -8
  52. package/build/src/enums/registrationMethod.enum.js +0 -7
  53. package/build/src/enums/socialLogins.enum.js +0 -6
  54. package/build/src/helpers/network.js +0 -93
  55. package/build/src/helpers/show-message/index.js +0 -19
  56. package/build/src/helpers/show-message/index.native.js +0 -14
  57. package/build/src/helpers/show-message/types.js +0 -1
  58. package/build/src/helpers/types.js +0 -1
  59. package/build/src/helpers/validation.js +0 -12
  60. package/build/src/hooks/internal/useAuthPackageContext.js +0 -9
  61. package/build/src/hooks/internal/useTimer.js +0 -40
  62. package/build/src/hooks/useAuthContext.js +0 -10
  63. package/build/src/hooks/useNavigator.js +0 -83
  64. package/build/src/hooks/useRequest.js +0 -34
  65. package/build/src/index.js +0 -23
  66. package/build/src/navigator/index.js +0 -10
  67. package/build/src/navigator/index.native.js +0 -27
  68. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.js +0 -37
  69. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.native.js +0 -6
  70. package/build/src/screens/CountryCode/components/CountryCodeDropdown/types.js +0 -1
  71. package/build/src/screens/CountryCode/hooks/internal/useCountryCode.js +0 -38
  72. package/build/src/screens/CountryCode/index.js +0 -10
  73. package/build/src/screens/CountryCode/index.native.js +0 -37
  74. package/build/src/screens/CountryCode/type.js +0 -1
  75. package/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +0 -46
  76. package/build/src/screens/CreatePassword/index.js +0 -16
  77. package/build/src/screens/CreatePassword/index.native.js +0 -32
  78. package/build/src/screens/CreatePassword/type.js +0 -1
  79. package/build/src/screens/EnterEmail/hooks/internal/useEnterEmail.js +0 -77
  80. package/build/src/screens/EnterEmail/index.js +0 -58
  81. package/build/src/screens/EnterEmail/index.native.js +0 -31
  82. package/build/src/screens/EnterEmail/types.js +0 -1
  83. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.js +0 -36
  84. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.js +0 -33
  85. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.native.js +0 -73
  86. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/types.js +0 -1
  87. package/build/src/screens/EnterMobile/hooks/internal/useEnterMobile.js +0 -67
  88. package/build/src/screens/EnterMobile/index.js +0 -81
  89. package/build/src/screens/EnterMobile/index.native.js +0 -56
  90. package/build/src/screens/EnterMobile/types.js +0 -1
  91. package/build/src/screens/EnterPassword/hooks/internal/useEnterPassword.js +0 -79
  92. package/build/src/screens/EnterPassword/index.js +0 -68
  93. package/build/src/screens/EnterPassword/index.native.js +0 -41
  94. package/build/src/screens/EnterPassword/types.js +0 -1
  95. package/build/src/screens/Login/components/LoginWebComponent/index.js +0 -63
  96. package/build/src/screens/Login/components/LoginWebComponent/index.native.js +0 -6
  97. package/build/src/screens/Login/index.js +0 -10
  98. package/build/src/screens/Login/index.native.js +0 -6
  99. package/build/src/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.js +0 -85
  100. package/build/src/screens/LoginWithEmailOTP/index.js +0 -8
  101. package/build/src/screens/LoginWithEmailOTP/index.native.js +0 -10
  102. package/build/src/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.js +0 -72
  103. package/build/src/screens/LoginWithMobileOTP/index.js +0 -8
  104. package/build/src/screens/LoginWithMobileOTP/index.native.js +0 -10
  105. package/build/src/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.js +0 -68
  106. package/build/src/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.js +0 -50
  107. package/build/src/screens/PartnerSSO/PartnerLogin/index.js +0 -2
  108. package/build/src/screens/PartnerSSO/PartnerLogin/types.js +0 -1
  109. package/build/src/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.js +0 -203
  110. package/build/src/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.js +0 -90
  111. package/build/src/screens/PartnerSSO/PartnerRegistration/index.js +0 -2
  112. package/build/src/screens/PartnerSSO/PartnerRegistration/types.js +0 -1
  113. package/build/src/screens/PartnerSSO/index.js +0 -2
  114. package/build/src/screens/Profile/components/EditMobileNumber/index.js +0 -31
  115. package/build/src/screens/Profile/components/EditMobileNumber/index.native.js +0 -8
  116. package/build/src/screens/Profile/components/EditPassword/index.js +0 -29
  117. package/build/src/screens/Profile/components/EditPassword/index.native.js +0 -8
  118. package/build/src/screens/Profile/components/EditProfile/index.js +0 -89
  119. package/build/src/screens/Profile/components/EditProfile/index.native.js +0 -8
  120. package/build/src/screens/Profile/components/OtpVerificationModal/index.js +0 -61
  121. package/build/src/screens/Profile/components/OtpVerificationModal/index.native.js +0 -7
  122. package/build/src/screens/Profile/components/ProfileWebComponent/index.js +0 -80
  123. package/build/src/screens/Profile/components/ProfileWebComponent/index.native.js +0 -9
  124. package/build/src/screens/Profile/hooks/internal/useProfile.js +0 -185
  125. package/build/src/screens/Profile/index.js +0 -6
  126. package/build/src/screens/Profile/index.native.js +0 -6
  127. package/build/src/screens/Profile/types.js +0 -1
  128. package/build/src/screens/ResetPassword/hooks/internal/useResetPassword.js +0 -57
  129. package/build/src/screens/ResetPassword/index.js +0 -46
  130. package/build/src/screens/ResetPassword/index.native.js +0 -26
  131. package/build/src/screens/ResetPassword/types.js +0 -1
  132. package/build/src/screens/SSOLogin/AuthWebView/index.js +0 -9
  133. package/build/src/screens/SSOLogin/AuthWebView/index.native.js +0 -42
  134. package/build/src/screens/SSOLogin/AuthWebView/types.js +0 -1
  135. package/build/src/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.js +0 -39
  136. package/build/src/screens/SSOLogin/AuthenticationMethods/index.js +0 -50
  137. package/build/src/screens/SSOLogin/AuthenticationMethods/index.native.js +0 -59
  138. package/build/src/screens/SSOLogin/AuthenticationMethods/types.js +0 -1
  139. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.js +0 -62
  140. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.js +0 -6
  141. package/build/src/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.js +0 -58
  142. package/build/src/screens/SSOLogin/SSOCallback/index.js +0 -9
  143. package/build/src/screens/SSOLogin/SSOCallback/index.native.js +0 -35
  144. package/build/src/screens/SSOLogin/SSOCallback/types.js +0 -1
  145. package/build/src/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.js +0 -71
  146. package/build/src/screens/SSOLogin/SearchOrganization/index.js +0 -46
  147. package/build/src/screens/SSOLogin/SearchOrganization/index.native.js +0 -37
  148. package/build/src/screens/SSOLogin/SearchOrganization/types.js +0 -1
  149. package/build/src/screens/SignUp/components/SignUpForm/index.js +0 -215
  150. package/build/src/screens/SignUp/components/SignUpForm/index.native.js +0 -6
  151. package/build/src/screens/SignUp/components/SignUpForm/type.js +0 -1
  152. package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +0 -62
  153. package/build/src/screens/SignUp/components/SignUpWebComponent/index.native.js +0 -6
  154. package/build/src/screens/SignUp/components/SignUpWebComponent/types.js +0 -1
  155. package/build/src/screens/SignUp/hooks/internal/useSignUp.js +0 -134
  156. package/build/src/screens/SignUp/index.js +0 -6
  157. package/build/src/screens/SignUp/index.native.js +0 -188
  158. package/build/src/screens/SignUp/types.js +0 -1
  159. package/build/src/screens/UserConsent/hooks/internal/useConsent.js +0 -64
  160. package/build/src/screens/UserConsent/index.js +0 -84
  161. package/build/src/screens/UserConsent/index.native.js +0 -47
  162. package/build/src/screens/UserConsent/types.js +0 -1
  163. package/build/src/screens/VerifyEmail/hooks/internal/useVerifyEmail.js +0 -69
  164. package/build/src/screens/VerifyEmail/index.js +0 -8
  165. package/build/src/screens/VerifyEmail/index.native.js +0 -14
  166. package/build/src/screens/VerifyEmail/types.js +0 -1
  167. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.js +0 -73
  168. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.js +0 -8
  169. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.js +0 -14
  170. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/types.js +0 -1
  171. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.js +0 -83
  172. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.js +0 -8
  173. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.js +0 -10
  174. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/types.js +0 -1
  175. package/build/src/screens/VerifyMobile/hooks/internal/useVerifyMobile.js +0 -74
  176. package/build/src/screens/VerifyMobile/index.js +0 -8
  177. package/build/src/screens/VerifyMobile/index.native.js +0 -9
  178. package/build/src/screens/VerifyMobile/types.js +0 -1
  179. package/build/src/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.js +0 -74
  180. package/build/src/screens/VerifyResetPasswordOTP/index.js +0 -8
  181. package/build/src/screens/VerifyResetPasswordOTP/index.native.js +0 -14
  182. package/build/src/screens/Welcome/SocialAuth/commonSocialAuth.js +0 -127
  183. package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.js +0 -187
  184. package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.js +0 -13
  185. package/build/src/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.js +0 -115
  186. package/build/src/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.js +0 -72
  187. package/build/src/screens/Welcome/components/SocialLoginModal/index.js +0 -9
  188. package/build/src/screens/Welcome/components/SocialLoginModal/index.native.js +0 -21
  189. package/build/src/screens/Welcome/components/SocialLoginModal/types.js +0 -1
  190. package/build/src/screens/Welcome/hooks/internal/useWelcome.js +0 -26
  191. package/build/src/screens/Welcome/index.js +0 -28
  192. package/build/src/screens/Welcome/index.native.js +0 -78
  193. package/build/src/types/types.js +0 -2
  194. package/build/types/api/auth.d.ts +0 -11
  195. package/build/types/api/axiosClient/index.d.ts +0 -1
  196. package/build/types/api/axiosClient/index.native.d.ts +0 -1
  197. package/build/types/components/AdvancedTransitionWrapper/index.d.ts +0 -3
  198. package/build/types/components/AdvancedTransitionWrapper/index.native.d.ts +0 -5
  199. package/build/types/components/AdvancedTransitionWrapper/types.d.ts +0 -25
  200. package/build/types/components/ConfirmationModal/index.d.ts +0 -3
  201. package/build/types/components/ConfirmationModal/index.native.d.ts +0 -3
  202. package/build/types/components/ConfirmationModal/types.d.ts +0 -16
  203. package/build/types/components/IonIcon/index.d.ts +0 -3
  204. package/build/types/components/IonIcon/index.native.d.ts +0 -4
  205. package/build/types/components/IonIcon/types.d.ts +0 -6
  206. package/build/types/components/LoadingAnimation/index.d.ts +0 -6
  207. package/build/types/components/OTPStatusLabel/index.d.ts +0 -2
  208. package/build/types/components/OTPStatusLabel/index.native.d.ts +0 -3
  209. package/build/types/components/OTPStatusLabel/types.d.ts +0 -6
  210. package/build/types/components/PasswordCriteria/hooks/usePasswordCriteria.d.ts +0 -8
  211. package/build/types/components/PasswordCriteria/index.d.ts +0 -3
  212. package/build/types/components/PasswordCriteria/index.native.d.ts +0 -3
  213. package/build/types/components/PasswordCriteria/types.d.ts +0 -15
  214. package/build/types/components/ScreenLayout/index.d.ts +0 -3
  215. package/build/types/components/ScreenLayout/index.native.d.ts +0 -3
  216. package/build/types/components/ScreenLayout/types.d.ts +0 -13
  217. package/build/types/components/SupportDetails/index.d.ts +0 -2
  218. package/build/types/components/SupportDetails/index.native.d.ts +0 -2
  219. package/build/types/components/VerifyEmailOTP/index.d.ts +0 -3
  220. package/build/types/components/VerifyEmailOTP/index.native.d.ts +0 -3
  221. package/build/types/components/VerifyEmailOTP/types.d.ts +0 -9
  222. package/build/types/components/VerifyMobileOTP/index.d.ts +0 -3
  223. package/build/types/components/VerifyMobileOTP/index.native.d.ts +0 -3
  224. package/build/types/components/VerifyMobileOTP/types.d.ts +0 -9
  225. package/build/types/constants/base-url/index.d.ts +0 -1
  226. package/build/types/constants/base-url/index.native.d.ts +0 -1
  227. package/build/types/constants/cdn-url/index.d.ts +0 -2
  228. package/build/types/constants/cdn-url/index.native.d.ts +0 -3
  229. package/build/types/constants/defaultPolicy.d.ts +0 -9
  230. package/build/types/constants/password-requirements.d.ts +0 -4
  231. package/build/types/constants/social-login-options.d.ts +0 -3
  232. package/build/types/contexts/AuthContext.d.ts +0 -38
  233. package/build/types/contexts/type.d.ts +0 -94
  234. package/build/types/enums/index.d.ts +0 -3
  235. package/build/types/enums/loginMethod.enum.d.ts +0 -7
  236. package/build/types/enums/registrationMethod.enum.d.ts +0 -6
  237. package/build/types/enums/socialLogins.enum.d.ts +0 -5
  238. package/build/types/helpers/network.d.ts +0 -5
  239. package/build/types/helpers/show-message/index.d.ts +0 -3
  240. package/build/types/helpers/show-message/index.native.d.ts +0 -3
  241. package/build/types/helpers/show-message/types.d.ts +0 -6
  242. package/build/types/helpers/types.d.ts +0 -19
  243. package/build/types/helpers/validation.d.ts +0 -2
  244. package/build/types/hooks/internal/useAuthPackageContext.d.ts +0 -1
  245. package/build/types/hooks/internal/useTimer.d.ts +0 -3
  246. package/build/types/hooks/useAuthContext.d.ts +0 -2
  247. package/build/types/hooks/useNavigator.d.ts +0 -66
  248. package/build/types/hooks/useRequest.d.ts +0 -5
  249. package/build/types/index.d.ts +0 -15
  250. package/build/types/navigator/index.d.ts +0 -2
  251. package/build/types/navigator/index.native.d.ts +0 -82
  252. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.d.ts +0 -3
  253. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.native.d.ts +0 -2
  254. package/build/types/screens/CountryCode/components/CountryCodeDropdown/types.d.ts +0 -17
  255. package/build/types/screens/CountryCode/hooks/internal/useCountryCode.d.ts +0 -12
  256. package/build/types/screens/CountryCode/index.d.ts +0 -2
  257. package/build/types/screens/CountryCode/index.native.d.ts +0 -2
  258. package/build/types/screens/CountryCode/type.d.ts +0 -11
  259. package/build/types/screens/CreatePassword/hooks/internal/useCreatePassword.d.ts +0 -37
  260. package/build/types/screens/CreatePassword/index.d.ts +0 -3
  261. package/build/types/screens/CreatePassword/index.native.d.ts +0 -4
  262. package/build/types/screens/CreatePassword/type.d.ts +0 -43
  263. package/build/types/screens/EnterEmail/hooks/internal/useEnterEmail.d.ts +0 -19
  264. package/build/types/screens/EnterEmail/index.d.ts +0 -3
  265. package/build/types/screens/EnterEmail/index.native.d.ts +0 -4
  266. package/build/types/screens/EnterEmail/types.d.ts +0 -13
  267. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.d.ts +0 -13
  268. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.d.ts +0 -3
  269. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.native.d.ts +0 -3
  270. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/types.d.ts +0 -28
  271. package/build/types/screens/EnterMobile/hooks/internal/useEnterMobile.d.ts +0 -15
  272. package/build/types/screens/EnterMobile/index.d.ts +0 -4
  273. package/build/types/screens/EnterMobile/index.native.d.ts +0 -4
  274. package/build/types/screens/EnterMobile/types.d.ts +0 -44
  275. package/build/types/screens/EnterPassword/hooks/internal/useEnterPassword.d.ts +0 -25
  276. package/build/types/screens/EnterPassword/index.d.ts +0 -3
  277. package/build/types/screens/EnterPassword/index.native.d.ts +0 -4
  278. package/build/types/screens/EnterPassword/types.d.ts +0 -24
  279. package/build/types/screens/Login/components/LoginWebComponent/index.d.ts +0 -2
  280. package/build/types/screens/Login/components/LoginWebComponent/index.native.d.ts +0 -2
  281. package/build/types/screens/Login/index.d.ts +0 -2
  282. package/build/types/screens/Login/index.native.d.ts +0 -2
  283. package/build/types/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.d.ts +0 -17
  284. package/build/types/screens/LoginWithEmailOTP/index.d.ts +0 -7
  285. package/build/types/screens/LoginWithEmailOTP/index.native.d.ts +0 -4
  286. package/build/types/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.d.ts +0 -11
  287. package/build/types/screens/LoginWithMobileOTP/index.d.ts +0 -5
  288. package/build/types/screens/LoginWithMobileOTP/index.native.d.ts +0 -4
  289. package/build/types/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.d.ts +0 -25
  290. package/build/types/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.d.ts +0 -8
  291. package/build/types/screens/PartnerSSO/PartnerLogin/index.d.ts +0 -2
  292. package/build/types/screens/PartnerSSO/PartnerLogin/types.d.ts +0 -35
  293. package/build/types/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.d.ts +0 -24
  294. package/build/types/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.d.ts +0 -8
  295. package/build/types/screens/PartnerSSO/PartnerRegistration/index.d.ts +0 -2
  296. package/build/types/screens/PartnerSSO/PartnerRegistration/types.d.ts +0 -63
  297. package/build/types/screens/PartnerSSO/index.d.ts +0 -2
  298. package/build/types/screens/Profile/components/EditMobileNumber/index.d.ts +0 -6
  299. package/build/types/screens/Profile/components/EditMobileNumber/index.native.d.ts +0 -3
  300. package/build/types/screens/Profile/components/EditPassword/index.d.ts +0 -6
  301. package/build/types/screens/Profile/components/EditPassword/index.native.d.ts +0 -3
  302. package/build/types/screens/Profile/components/EditProfile/index.d.ts +0 -6
  303. package/build/types/screens/Profile/components/EditProfile/index.native.d.ts +0 -3
  304. package/build/types/screens/Profile/components/OtpVerificationModal/index.d.ts +0 -4
  305. package/build/types/screens/Profile/components/OtpVerificationModal/index.native.d.ts +0 -3
  306. package/build/types/screens/Profile/components/ProfileWebComponent/index.d.ts +0 -4
  307. package/build/types/screens/Profile/components/ProfileWebComponent/index.native.d.ts +0 -3
  308. package/build/types/screens/Profile/hooks/internal/useProfile.d.ts +0 -26
  309. package/build/types/screens/Profile/index.d.ts +0 -7
  310. package/build/types/screens/Profile/index.native.d.ts +0 -7
  311. package/build/types/screens/Profile/types.d.ts +0 -53
  312. package/build/types/screens/ResetPassword/hooks/internal/useResetPassword.d.ts +0 -29
  313. package/build/types/screens/ResetPassword/index.d.ts +0 -3
  314. package/build/types/screens/ResetPassword/index.native.d.ts +0 -4
  315. package/build/types/screens/ResetPassword/types.d.ts +0 -11
  316. package/build/types/screens/SSOLogin/AuthWebView/index.d.ts +0 -2
  317. package/build/types/screens/SSOLogin/AuthWebView/index.native.d.ts +0 -4
  318. package/build/types/screens/SSOLogin/AuthWebView/types.d.ts +0 -8
  319. package/build/types/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.d.ts +0 -9
  320. package/build/types/screens/SSOLogin/AuthenticationMethods/index.d.ts +0 -3
  321. package/build/types/screens/SSOLogin/AuthenticationMethods/index.native.d.ts +0 -4
  322. package/build/types/screens/SSOLogin/AuthenticationMethods/types.d.ts +0 -14
  323. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.d.ts +0 -6
  324. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.d.ts +0 -2
  325. package/build/types/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.d.ts +0 -15
  326. package/build/types/screens/SSOLogin/SSOCallback/index.d.ts +0 -2
  327. package/build/types/screens/SSOLogin/SSOCallback/index.native.d.ts +0 -4
  328. package/build/types/screens/SSOLogin/SSOCallback/types.d.ts +0 -14
  329. package/build/types/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.d.ts +0 -18
  330. package/build/types/screens/SSOLogin/SearchOrganization/index.d.ts +0 -3
  331. package/build/types/screens/SSOLogin/SearchOrganization/index.native.d.ts +0 -4
  332. package/build/types/screens/SSOLogin/SearchOrganization/types.d.ts +0 -13
  333. package/build/types/screens/SignUp/components/SignUpForm/index.d.ts +0 -3
  334. package/build/types/screens/SignUp/components/SignUpForm/index.native.d.ts +0 -2
  335. package/build/types/screens/SignUp/components/SignUpForm/type.d.ts +0 -6
  336. package/build/types/screens/SignUp/components/SignUpWebComponent/index.d.ts +0 -2
  337. package/build/types/screens/SignUp/components/SignUpWebComponent/index.native.d.ts +0 -2
  338. package/build/types/screens/SignUp/components/SignUpWebComponent/types.d.ts +0 -9
  339. package/build/types/screens/SignUp/hooks/internal/useSignUp.d.ts +0 -48
  340. package/build/types/screens/SignUp/index.d.ts +0 -2
  341. package/build/types/screens/SignUp/index.native.d.ts +0 -4
  342. package/build/types/screens/SignUp/types.d.ts +0 -40
  343. package/build/types/screens/UserConsent/hooks/internal/useConsent.d.ts +0 -10
  344. package/build/types/screens/UserConsent/index.d.ts +0 -3
  345. package/build/types/screens/UserConsent/index.native.d.ts +0 -4
  346. package/build/types/screens/UserConsent/types.d.ts +0 -33
  347. package/build/types/screens/VerifyEmail/hooks/internal/useVerifyEmail.d.ts +0 -19
  348. package/build/types/screens/VerifyEmail/index.d.ts +0 -3
  349. package/build/types/screens/VerifyEmail/index.native.d.ts +0 -4
  350. package/build/types/screens/VerifyEmail/types.d.ts +0 -8
  351. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.d.ts +0 -15
  352. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.d.ts +0 -3
  353. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.d.ts +0 -4
  354. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/types.d.ts +0 -14
  355. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.d.ts +0 -17
  356. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.d.ts +0 -3
  357. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.d.ts +0 -4
  358. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/types.d.ts +0 -5
  359. package/build/types/screens/VerifyMobile/hooks/internal/useVerifyMobile.d.ts +0 -14
  360. package/build/types/screens/VerifyMobile/index.d.ts +0 -3
  361. package/build/types/screens/VerifyMobile/index.native.d.ts +0 -4
  362. package/build/types/screens/VerifyMobile/types.d.ts +0 -5
  363. package/build/types/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.d.ts +0 -19
  364. package/build/types/screens/VerifyResetPasswordOTP/index.d.ts +0 -7
  365. package/build/types/screens/VerifyResetPasswordOTP/index.native.d.ts +0 -4
  366. package/build/types/screens/Welcome/SocialAuth/commonSocialAuth.d.ts +0 -50
  367. package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.d.ts +0 -7
  368. package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.d.ts +0 -7
  369. package/build/types/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.d.ts +0 -5
  370. package/build/types/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.d.ts +0 -4
  371. package/build/types/screens/Welcome/components/SocialLoginModal/index.d.ts +0 -3
  372. package/build/types/screens/Welcome/components/SocialLoginModal/index.native.d.ts +0 -3
  373. package/build/types/screens/Welcome/components/SocialLoginModal/types.d.ts +0 -8
  374. package/build/types/screens/Welcome/hooks/internal/useWelcome.d.ts +0 -22
  375. package/build/types/screens/Welcome/index.d.ts +0 -4
  376. package/build/types/screens/Welcome/index.native.d.ts +0 -4
  377. package/build/types/types/types.d.ts +0 -115
@@ -1,83 +0,0 @@
1
- import { useCallback, useEffect, useRef, useState } from "react";
2
- import { showMessage } from "../../../../helpers/show-message";
3
- import { useInterval } from "../../../../hooks/internal/useTimer";
4
- import { axiosClient } from "../../../../api/axiosClient";
5
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
6
- const initialTimer = 180;
7
- /**
8
- * @internal
9
- * Hook for managing useVerifyLinkPrimaryAccountMobileOTP hook state and auth context integration.
10
- * This hook is not exposed to package consumers.
11
- */
12
- const useVerifyLinkPrimaryAccountMobileOTP = ({ sessionToken }) => {
13
- const [status, setStatus] = useState('timer');
14
- const [timer, setTimer] = useState(initialTimer);
15
- const { onLogin, onTokenChange } = useAuthPackageContext();
16
- const invalidTimerRef = useRef(null);
17
- const sessionTokenRef = useRef(sessionToken);
18
- useInterval(() => {
19
- setTimer((t) => (t > 0 ? t - 1 : 0));
20
- }, 1000);
21
- const sendOTP = useCallback(() => {
22
- setStatus('loading');
23
- axiosClient({
24
- url: '/auth/mobile/link-primary-account/resend-mobile-otp',
25
- method: 'POST',
26
- data: { sessionToken: sessionTokenRef.current },
27
- }).then((res) => {
28
- setStatus('timer');
29
- setTimer(initialTimer);
30
- sessionTokenRef.current = res.data.sessionToken;
31
- }).catch((err) => {
32
- console.log(err);
33
- const message = err?.response?.data?.errors?.[0]?.message ?? 'Unable to send OTP. Please try again.';
34
- showMessage({ message });
35
- }).finally(() => setStatus('timer'));
36
- }, []);
37
- const validateOTP = useCallback(({ otp, source }) => {
38
- setStatus('loading');
39
- axiosClient({
40
- url: '/auth/mobile/link-primary-account/verify-mobile-otp',
41
- method: 'POST',
42
- data: {
43
- otp,
44
- sessionToken: sessionTokenRef.current,
45
- source
46
- },
47
- }).then((res) => {
48
- const { token, member } = res.data;
49
- setStatus('valid');
50
- onTokenChange(token);
51
- onLogin({ token, member });
52
- }).catch((err) => {
53
- if (err?.response?.status === 400) {
54
- setStatus('invalid');
55
- if (invalidTimerRef.current)
56
- clearTimeout(invalidTimerRef.current);
57
- invalidTimerRef.current = setTimeout(() => setStatus('timer'), 5000);
58
- showMessage({ message: err?.response?.data?.errors?.[0]?.message ?? 'Invalid OTP. Please try again.' });
59
- }
60
- else {
61
- const message = err?.response?.data?.errors?.[0]?.message ?? 'Verification failed. Please try again.';
62
- showMessage({ message });
63
- setStatus('timer');
64
- }
65
- });
66
- }, []);
67
- useEffect(() => {
68
- return () => {
69
- if (invalidTimerRef.current)
70
- clearTimeout(invalidTimerRef.current);
71
- };
72
- }, []);
73
- useEffect(() => {
74
- sendOTP();
75
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
76
- return {
77
- timer,
78
- status,
79
- sendOTP,
80
- validateOTP
81
- };
82
- };
83
- export { useVerifyLinkPrimaryAccountMobileOTP };
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { VerifyMobileOTP } from "../../components/VerifyMobileOTP";
3
- import { useVerifyLinkPrimaryAccountMobileOTP } from "./hooks/internal/useVerifyLinkPrimaryAccountMobileOTP";
4
- const VerifyLinkPrimaryAccountMobileOTP = ({ phone, sessionToken }) => {
5
- const { timer, status, validateOTP, sendOTP, } = useVerifyLinkPrimaryAccountMobileOTP({ sessionToken });
6
- return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: (otp) => validateOTP({ otp, source: 'web' }), resendOTP: sendOTP }));
7
- };
8
- export default VerifyLinkPrimaryAccountMobileOTP;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { VerifyMobileOTP } from '../../components/VerifyMobileOTP';
3
- import { useVerifyLinkPrimaryAccountMobileOTP } from './hooks/internal/useVerifyLinkPrimaryAccountMobileOTP';
4
- import { Platform } from 'react-native';
5
- const VerifyLinkPrimaryAccountMobileOTP = ({ route }) => {
6
- const { sessionToken, phone } = route.params;
7
- const { timer, status, validateOTP, sendOTP, } = useVerifyLinkPrimaryAccountMobileOTP({ sessionToken });
8
- return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: (otp) => validateOTP({ otp, source: Platform.OS }), resendOTP: sendOTP }));
9
- };
10
- export default VerifyLinkPrimaryAccountMobileOTP;
@@ -1,74 +0,0 @@
1
- import { useCallback, useEffect, useState } from "react";
2
- import { showMessage } from "../../../../helpers/show-message";
3
- import { useInterval } from "../../../../hooks/internal/useTimer";
4
- import { axiosClient } from "../../../../api/axiosClient";
5
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
6
- const initialTimer = 180;
7
- /**
8
- * @internal
9
- * Hook for managing VerifyMobile screen state and auth context integration.
10
- * This hook is not exposed to package consumers.
11
- */
12
- const useVerifyMobile = ({ sessionToken }) => {
13
- const [sessionTokenState, setSessionToken] = useState(sessionToken || '');
14
- const [timer, setTimer] = useState(initialTimer);
15
- const [status, setStatus] = useState('timer');
16
- const { onLogin, onTokenChange } = useAuthPackageContext();
17
- useEffect(() => {
18
- resendOTP();
19
- }, []);
20
- useInterval(() => {
21
- if (!timer) {
22
- return;
23
- }
24
- setTimer(timer - 1);
25
- }, 1000);
26
- const resendOTP = useCallback(() => {
27
- setStatus('loading');
28
- axiosClient({
29
- url: '/auth/registration/mobile/send-otp',
30
- method: 'POST',
31
- data: { sessionToken: sessionTokenState },
32
- }).then((res) => {
33
- setStatus('timer');
34
- setTimer(initialTimer);
35
- setSessionToken(res.data.sessionToken);
36
- }).catch((err) => {
37
- console.log(err);
38
- const message = err?.response?.data?.errors?.[0]?.message ?? 'Unable to send OTP. Please try again.';
39
- showMessage({ message });
40
- setStatus('timer');
41
- });
42
- }, [sessionTokenState]);
43
- const validateOTP = useCallback((otp) => {
44
- setStatus('loading');
45
- axiosClient({
46
- url: '/auth/registration/mobile/verify-otp',
47
- method: 'POST',
48
- data: { otp, sessionToken: sessionTokenState },
49
- }).then((res) => {
50
- const { token, member } = res.data;
51
- onTokenChange(token);
52
- onLogin({ token, member });
53
- setStatus('valid');
54
- }).catch((err) => {
55
- if (err?.response?.status === 400) {
56
- setStatus('invalid');
57
- setTimeout(() => setStatus('timer'), 5000);
58
- showMessage({ message: err?.response?.data?.errors?.[0]?.message ?? 'Invalid OTP. Please try again.' });
59
- }
60
- else {
61
- const message = err?.response?.data?.errors?.[0]?.message ?? 'Verification failed. Please try again.';
62
- showMessage({ message });
63
- setStatus('timer');
64
- }
65
- });
66
- }, [sessionTokenState]);
67
- return {
68
- timer,
69
- status,
70
- resendOTP,
71
- validateOTP
72
- };
73
- };
74
- export { useVerifyMobile };
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { VerifyMobileOTP } from "../../components/VerifyMobileOTP";
3
- import { useVerifyMobile } from "./hooks/internal/useVerifyMobile";
4
- const VerifyMobile = ({ sessionToken, phone }) => {
5
- const { timer, status, validateOTP, resendOTP, } = useVerifyMobile({ sessionToken });
6
- return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: validateOTP, resendOTP: resendOTP }));
7
- };
8
- export default VerifyMobile;
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { VerifyMobileOTP } from '../../components/VerifyMobileOTP';
3
- import { useVerifyMobile } from './hooks/internal/useVerifyMobile';
4
- const VerifyMobile = ({ route }) => {
5
- const { sessionToken, phone } = route.params || {};
6
- const { timer, status, validateOTP, resendOTP, } = useVerifyMobile({ sessionToken });
7
- return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: validateOTP, resendOTP: resendOTP }));
8
- };
9
- export default VerifyMobile;
@@ -1 +0,0 @@
1
- export {};
@@ -1,74 +0,0 @@
1
- import { useCallback, useEffect, useState, useRef } from "react";
2
- import { showMessage } from "../../../../helpers/show-message";
3
- import { axiosClient } from "../../../../api/axiosClient";
4
- /**
5
- * @internal
6
- * Hook for managing VerifyResetPasswordOTP screen state and auth context integration.
7
- * This hook is not exposed to package consumers.
8
- */
9
- const useVerifyResetPasswordOTP = ({ email }) => {
10
- const [resendOTPCounter, setResendOTPCounter] = useState(0);
11
- const [status, setStatus] = useState("idle");
12
- const resetStatusTimeoutRef = useRef();
13
- const sessionTokenRef = useRef('');
14
- const scheduleStatusReset = (delay) => {
15
- if (resetStatusTimeoutRef.current) {
16
- clearTimeout(resetStatusTimeoutRef.current);
17
- }
18
- resetStatusTimeoutRef.current = setTimeout(() => setStatus('idle'), delay);
19
- };
20
- const sendOtp = useCallback(() => {
21
- setStatus('loading');
22
- axiosClient({
23
- url: '/auth/reset-password/send-otp',
24
- method: 'POST',
25
- data: { email },
26
- }).then((res) => {
27
- setResendOTPCounter(prevCounter => prevCounter + 1);
28
- sessionTokenRef.current = res.data.sessionToken;
29
- }).catch((error) => {
30
- console.log('Failed to send OTP:', error);
31
- const message = error?.response?.data?.errors?.[0]?.message || "Failed to send OTP. Please try again.";
32
- showMessage({ message });
33
- }).finally(() => setStatus("idle"));
34
- }, [email]);
35
- const verifyOtp = useCallback(({ otp, onVerifiedOTP }) => {
36
- setStatus('loading');
37
- axiosClient({
38
- url: "/auth/reset-password/verify-otp",
39
- method: "POST",
40
- data: { sessionToken: sessionTokenRef.current, otp },
41
- }).then((res) => {
42
- setStatus('valid');
43
- onVerifiedOTP({ sessionToken: res.data.sessionToken });
44
- scheduleStatusReset(0);
45
- }).catch((error) => {
46
- const message = error?.response?.data?.errors?.[0]?.message ||
47
- (error?.response?.status === 400
48
- ? "Invalid OTP. Please try again."
49
- : "Verification failed. Please try again.");
50
- showMessage({ message });
51
- setStatus(error?.response?.status === 400 ? "invalid" : "idle");
52
- if (error?.response?.status === 400) {
53
- scheduleStatusReset(5000);
54
- }
55
- });
56
- }, []);
57
- useEffect(() => () => {
58
- if (resetStatusTimeoutRef.current) {
59
- clearTimeout(resetStatusTimeoutRef.current);
60
- }
61
- }, []);
62
- useEffect(() => {
63
- if (email) {
64
- sendOtp();
65
- }
66
- }, [email, sendOtp]);
67
- return {
68
- status,
69
- resendOTPCounter,
70
- sendOtp,
71
- verifyOtp,
72
- };
73
- };
74
- export { useVerifyResetPasswordOTP };
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useVerifyResetPasswordOTP } from "./hooks/internal/useVerifyResetPasswordOTP";
3
- import { VerifyEmailOTP } from "../../components/VerifyEmailOTP";
4
- const VerifyResetPasswordOTP = ({ email, onVerifiedOTP }) => {
5
- const { status, resendOTPCounter, sendOtp, verifyOtp, } = useVerifyResetPasswordOTP({ email });
6
- return (_jsx(VerifyEmailOTP, { email: email, validateOTP: (otp) => verifyOtp({ otp, onVerifiedOTP }), resendOTP: sendOtp, status: status, resendOTPCounter: resendOTPCounter }));
7
- };
8
- export default VerifyResetPasswordOTP;
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useVerifyResetPasswordOTP } from './hooks/internal/useVerifyResetPasswordOTP';
3
- import { VerifyEmailOTP } from '../../components/VerifyEmailOTP';
4
- const VerifyResetPasswordOTP = ({ navigation, route }) => {
5
- const { email } = route.params;
6
- const { status, resendOTPCounter, sendOtp, verifyOtp, } = useVerifyResetPasswordOTP({ email });
7
- return (_jsx(VerifyEmailOTP, { email: email, validateOTP: (otp) => {
8
- verifyOtp({
9
- otp,
10
- onVerifiedOTP: ({ sessionToken }) => navigation.navigate('ResetPassword', { sessionToken, email })
11
- });
12
- }, resendOTP: sendOtp, status: status, resendOTPCounter: resendOTPCounter }));
13
- };
14
- export default VerifyResetPasswordOTP;
@@ -1,127 +0,0 @@
1
- // src/screens/Welcome/SocialAuth/commonSocialAuth.ts
2
- import { LoginMethodCode, SocialLoginsEnum } from "../../../enums";
3
- import { axiosClient } from "../../../api/axiosClient";
4
- import { checkEmailExists } from "../../../api/auth";
5
- // ============================================
6
- // TYPES & ENUMS
7
- // ============================================
8
- export var SocialAuthStatus;
9
- (function (SocialAuthStatus) {
10
- SocialAuthStatus["REGISTER"] = "REGISTER";
11
- SocialAuthStatus["INVALID"] = "INVALID";
12
- SocialAuthStatus["SUCCESS"] = "SUCCESS";
13
- })(SocialAuthStatus || (SocialAuthStatus = {}));
14
- // ============================================
15
- // CONSTANTS
16
- // ============================================
17
- const EXISTING_LOGIN_TYPE = {
18
- [LoginMethodCode.Email]: 'Email Address',
19
- [LoginMethodCode.Facebook]: 'Facebook Account',
20
- [LoginMethodCode.Google]: 'Google Account',
21
- [LoginMethodCode.Apple]: 'Apple ID',
22
- };
23
- const PROVIDER_CONFIG = {
24
- [SocialLoginsEnum.Google]: {
25
- endpoint: '/auth/google',
26
- tokenKey: 'token',
27
- loginMethodCode: LoginMethodCode.Google,
28
- },
29
- [SocialLoginsEnum.Facebook]: {
30
- endpoint: '/auth/facebook',
31
- tokenKey: 'token',
32
- loginMethodCode: LoginMethodCode.Facebook,
33
- },
34
- [SocialLoginsEnum.Apple]: {
35
- endpoint: '/auth/apple/appleid-exists',
36
- tokenKey: 'token',
37
- loginMethodCode: LoginMethodCode.Apple,
38
- },
39
- };
40
- // ============================================
41
- // HELPER FUNCTIONS
42
- // ============================================
43
- /**
44
- * Verifies if the attempted login method matches the registered method for an email
45
- * @param email - User's email address
46
- * @param attemptedLoginCode - Login method code being attempted
47
- * @returns Verification result with email existence and validity
48
- */
49
- const verifyLoginType = async (email, attemptedLoginCode) => {
50
- const { emailExist, loginType } = await checkEmailExists(email);
51
- const existingLoginCode = Number(loginType);
52
- if (emailExist) {
53
- const isValidLoginType = EXISTING_LOGIN_TYPE[attemptedLoginCode] === EXISTING_LOGIN_TYPE[existingLoginCode];
54
- return {
55
- emailExist,
56
- isValidLoginType,
57
- existingLoginType: EXISTING_LOGIN_TYPE[existingLoginCode],
58
- };
59
- }
60
- return { emailExist };
61
- };
62
- /**
63
- * Generic handler for social authentication
64
- * @param provider - Social provider (google, facebook, apple)
65
- * @param email - User's email
66
- * @param identityToken - Provider's identity token
67
- * @param platform - Platform (web, ios, android)
68
- * @returns Authentication result
69
- */
70
- const handleSocialAuth = async (provider, email, identityToken, platform) => {
71
- try {
72
- const config = PROVIDER_CONFIG[provider];
73
- // Verify login type
74
- const { emailExist, isValidLoginType, existingLoginType } = await verifyLoginType(email, config.loginMethodCode);
75
- // New user - needs registration
76
- if (!emailExist) {
77
- return {
78
- status: SocialAuthStatus.REGISTER,
79
- data: { email },
80
- };
81
- }
82
- // Wrong Social login method
83
- if (!isValidLoginType) {
84
- return {
85
- status: SocialAuthStatus.INVALID,
86
- data: { existingLoginType },
87
- };
88
- }
89
- // Authenticate with backend
90
- const { data } = await axiosClient.post(config.endpoint, {
91
- [config.tokenKey]: identityToken,
92
- source: platform,
93
- });
94
- return {
95
- status: SocialAuthStatus.SUCCESS,
96
- data: {
97
- token: data.token,
98
- member: data.member,
99
- },
100
- };
101
- }
102
- catch (error) {
103
- // Let the calling code handle the error
104
- throw error;
105
- }
106
- };
107
- // ============================================
108
- // PUBLIC API
109
- // ============================================
110
- /**
111
- * Handles Google authentication
112
- */
113
- export const handleGoogleAuth = async ({ email, googleIdentityToken, platform, }) => {
114
- return handleSocialAuth(SocialLoginsEnum.Google, email, googleIdentityToken, platform);
115
- };
116
- /**
117
- * Handles Facebook authentication
118
- */
119
- export const handleFacebookAuth = async ({ email, facebookIdentityToken, platform }) => {
120
- return handleSocialAuth(SocialLoginsEnum.Facebook, email, facebookIdentityToken, platform);
121
- };
122
- /**
123
- * Handles Apple authentication
124
- */
125
- export const handleAppleAuth = async ({ email, appleIdentityToken, platform }) => {
126
- return handleSocialAuth(SocialLoginsEnum.Apple, email, appleIdentityToken, platform);
127
- };
@@ -1,187 +0,0 @@
1
- import { useCallback, useState } from "react";
2
- import { Alert, Linking, Platform } from "react-native";
3
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
4
- import { useNavigation } from "@react-navigation/native";
5
- import { GoogleSignin } from "@react-native-google-signin/google-signin";
6
- import { handleAppleAuth, handleFacebookAuth, handleGoogleAuth, SocialAuthStatus } from "../commonSocialAuth";
7
- import { RegistrationMethod, SocialLoginsEnum } from "../../../../enums";
8
- import { showMessage } from "../../../../helpers/show-message";
9
- import { AccessToken, GraphRequest, GraphRequestManager, LoginManager } from "react-native-fbsdk-next";
10
- import appleAuth from '@invertase/react-native-apple-authentication';
11
- import { axiosClient } from "../../../../api/axiosClient";
12
- const useSocialAuth = () => {
13
- const [loading, setLoading] = useState(false);
14
- const { onLogin, socialLoginConfig, onRegistrationMethodChange, onTokenChange } = useAuthPackageContext();
15
- const navigation = useNavigation();
16
- const googleAppId = socialLoginConfig?.google?.webClientId;
17
- const loginWithGoogle = useCallback(async () => {
18
- try {
19
- setLoading(true);
20
- GoogleSignin.configure({ webClientId: googleAppId });
21
- await GoogleSignin.hasPlayServices();
22
- const googleResponse = await GoogleSignin.signIn();
23
- const { user, idToken } = googleResponse || {};
24
- if (!user || !idToken) {
25
- return showMessage({
26
- message: "Google login failed",
27
- type: "error"
28
- });
29
- }
30
- const result = await handleGoogleAuth({
31
- email: user.email,
32
- googleIdentityToken: idToken,
33
- platform: Platform.OS === "ios" ? "ios" : "android",
34
- });
35
- return handleSocialAuthResult(result, {
36
- email: user.email,
37
- firstName: user.givenName ?? '',
38
- lastName: user.familyName ?? '',
39
- googleUserId: user.id,
40
- }, SocialLoginsEnum.Google);
41
- }
42
- catch (err) {
43
- console.log("Google login failed:", err);
44
- return { error: err };
45
- }
46
- finally {
47
- setLoading(false);
48
- }
49
- }, [googleAppId]);
50
- const loginWithFacebook = useCallback(async () => {
51
- try {
52
- const facebookResponse = await LoginManager.logInWithPermissions(['public_profile', 'email']);
53
- if (facebookResponse.isCancelled) {
54
- return;
55
- }
56
- setLoading(true);
57
- const fbAccessToken = await AccessToken.getCurrentAccessToken();
58
- const profile = await new Promise((resolve, reject) => {
59
- new GraphRequestManager().addRequest(new GraphRequest('/me', {
60
- accessToken: fbAccessToken?.accessToken,
61
- parameters: { fields: { string: 'email,name' } },
62
- }, (err, res) => (err ? reject(err) : resolve(res)))).start();
63
- });
64
- if (!profile.email || !profile.id) {
65
- return showMessage({
66
- message: "Facebook login failed",
67
- type: "error"
68
- });
69
- }
70
- const nameParts = profile.name?.split(' ') || [];
71
- const firstName = nameParts[0] || undefined;
72
- const lastName = nameParts.slice(1).join(' ') || undefined;
73
- const result = await handleFacebookAuth({
74
- email: profile.email,
75
- facebookIdentityToken: fbAccessToken?.accessToken ?? '',
76
- platform: Platform.OS === "ios" ? "ios" : "android",
77
- });
78
- return handleSocialAuthResult(result, {
79
- email: profile.email,
80
- firstName,
81
- lastName,
82
- fbUserId: profile.id
83
- }, SocialLoginsEnum.Facebook);
84
- }
85
- catch (err) {
86
- console.log("Facebook login failed:", err);
87
- return { error: err };
88
- }
89
- finally {
90
- setLoading(false);
91
- }
92
- }, []);
93
- const loginWithApple = useCallback(async () => {
94
- try {
95
- const appleAuthResponse = await appleAuth.performRequest({
96
- requestedOperation: appleAuth.Operation.LOGIN,
97
- requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
98
- });
99
- const credentialState = await appleAuth.getCredentialStateForUser(appleAuthResponse.user);
100
- if (credentialState !== appleAuth.State.AUTHORIZED) {
101
- return;
102
- }
103
- setLoading(true);
104
- if (!appleAuthResponse.email) {
105
- try {
106
- const { data } = await axiosClient.post('/auth/apple', {
107
- token: appleAuthResponse.identityToken,
108
- source: Platform.OS,
109
- });
110
- onTokenChange(data.token);
111
- onLogin({ token: data.token, member: data.member });
112
- return;
113
- }
114
- catch (error) {
115
- return Alert.alert('Account Not Found!', "The Wellness Corner account linked with this Apple ID was not found. Please unlink this Apple ID from The Wellness Corner app and try again. To stop using this Apple ID with The Wellness Corner, tap on 'Know More' below.", [
116
- {
117
- text: 'Know More',
118
- style: 'default',
119
- onPress: () => Linking.openURL('https://support.apple.com/en-in/HT210426')
120
- },
121
- {
122
- text: 'Cancel',
123
- style: 'cancel'
124
- }
125
- ], { cancelable: true });
126
- }
127
- finally {
128
- setLoading(false);
129
- }
130
- }
131
- if (!appleAuthResponse.identityToken || !appleAuthResponse.email) {
132
- return showMessage({
133
- message: "Apple login failed",
134
- type: "error"
135
- });
136
- }
137
- const result = await handleAppleAuth({
138
- email: appleAuthResponse.email,
139
- appleIdentityToken: appleAuthResponse.identityToken,
140
- platform: Platform.OS === "ios" ? "ios" : "android",
141
- });
142
- return handleSocialAuthResult(result, {
143
- email: appleAuthResponse.email,
144
- firstName: appleAuthResponse.fullName?.givenName ?? '',
145
- lastName: appleAuthResponse.fullName?.familyName ?? '',
146
- appleUserId: appleAuthResponse.user
147
- }, SocialLoginsEnum.Apple);
148
- }
149
- catch (error) {
150
- console.log("Apple login failed:", error);
151
- return { error: error };
152
- }
153
- finally {
154
- setLoading(false);
155
- }
156
- }, []);
157
- const providerCleanup = {
158
- google: () => GoogleSignin.signOut(),
159
- facebook: () => LoginManager.logOut(),
160
- apple: () => Promise.resolve(), // Apple doesn't need explicit cleanup
161
- };
162
- const handleSocialAuthResult = async (result, userData, providerName) => {
163
- switch (result.status) {
164
- case SocialAuthStatus.REGISTER:
165
- onRegistrationMethodChange(RegistrationMethod.SOCIAL);
166
- return navigation.navigate('SignUp', userData);
167
- case SocialAuthStatus.INVALID:
168
- // Clean up provider session
169
- await providerCleanup[providerName]();
170
- return showMessage({
171
- message: `You have previously registered using your ${result.data.existingLoginType}. Please use your ${result.data.existingLoginType} to login.`,
172
- type: 'error'
173
- });
174
- case SocialAuthStatus.SUCCESS:
175
- onTokenChange(result.data.token);
176
- onLogin({ token: result.data.token, member: result.data.member });
177
- break;
178
- }
179
- };
180
- return {
181
- loading,
182
- loginWithGoogle,
183
- loginWithFacebook,
184
- loginWithApple
185
- };
186
- };
187
- export { useSocialAuth };
@@ -1,13 +0,0 @@
1
- import { useFacebookAuth } from "./web/useFacebookAuth.web";
2
- import { useGoogleAuth } from "./web/useGoogleAuth.web";
3
- const useSocialAuth = () => {
4
- const { loginWithGoogle, googleSignOut } = useGoogleAuth();
5
- const { loginWithFacebook, facebookSignOut } = useFacebookAuth();
6
- return {
7
- loginWithGoogle,
8
- googleSignOut,
9
- loginWithFacebook,
10
- facebookSignOut
11
- };
12
- };
13
- export { useSocialAuth };