@truworth/twc-auth 3.0.5 → 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 (375) 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/OTPStatusLabel/index.js +0 -10
  23. package/build/src/components/OTPStatusLabel/index.native.js +0 -21
  24. package/build/src/components/OTPStatusLabel/types.js +0 -1
  25. package/build/src/components/PasswordCriteria/hooks/usePasswordCriteria.js +0 -71
  26. package/build/src/components/PasswordCriteria/index.js +0 -47
  27. package/build/src/components/PasswordCriteria/index.native.js +0 -22
  28. package/build/src/components/PasswordCriteria/types.js +0 -1
  29. package/build/src/components/ScreenLayout/index.js +0 -12
  30. package/build/src/components/ScreenLayout/index.native.js +0 -18
  31. package/build/src/components/ScreenLayout/types.js +0 -1
  32. package/build/src/components/SupportDetails/index.js +0 -9
  33. package/build/src/components/SupportDetails/index.native.js +0 -6
  34. package/build/src/components/VerifyEmailOTP/index.js +0 -20
  35. package/build/src/components/VerifyEmailOTP/index.native.js +0 -22
  36. package/build/src/components/VerifyEmailOTP/types.js +0 -1
  37. package/build/src/components/VerifyMobileOTP/index.js +0 -25
  38. package/build/src/components/VerifyMobileOTP/index.native.js +0 -38
  39. package/build/src/components/VerifyMobileOTP/types.js +0 -1
  40. package/build/src/constants/base-url/index.js +0 -5
  41. package/build/src/constants/base-url/index.native.js +0 -1
  42. package/build/src/constants/cdn-url/index.js +0 -2
  43. package/build/src/constants/cdn-url/index.native.js +0 -5
  44. package/build/src/constants/defaultPolicy.js +0 -9
  45. package/build/src/constants/password-requirements.js +0 -7
  46. package/build/src/constants/social-login-options.js +0 -16
  47. package/build/src/contexts/AuthContext.js +0 -190
  48. package/build/src/contexts/type.js +0 -1
  49. package/build/src/enums/index.js +0 -3
  50. package/build/src/enums/loginMethod.enum.js +0 -8
  51. package/build/src/enums/registrationMethod.enum.js +0 -7
  52. package/build/src/enums/socialLogins.enum.js +0 -6
  53. package/build/src/helpers/network.js +0 -93
  54. package/build/src/helpers/show-message/index.js +0 -19
  55. package/build/src/helpers/show-message/index.native.js +0 -14
  56. package/build/src/helpers/show-message/types.js +0 -1
  57. package/build/src/helpers/types.js +0 -1
  58. package/build/src/helpers/validation.js +0 -12
  59. package/build/src/hooks/internal/useAuthPackageContext.js +0 -9
  60. package/build/src/hooks/internal/useTimer.js +0 -40
  61. package/build/src/hooks/useAuthContext.js +0 -10
  62. package/build/src/hooks/useNavigator.js +0 -83
  63. package/build/src/hooks/useRequest.js +0 -34
  64. package/build/src/index.js +0 -23
  65. package/build/src/navigator/index.js +0 -10
  66. package/build/src/navigator/index.native.js +0 -27
  67. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.js +0 -37
  68. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.native.js +0 -6
  69. package/build/src/screens/CountryCode/components/CountryCodeDropdown/types.js +0 -1
  70. package/build/src/screens/CountryCode/hooks/internal/useCountryCode.js +0 -38
  71. package/build/src/screens/CountryCode/index.js +0 -10
  72. package/build/src/screens/CountryCode/index.native.js +0 -37
  73. package/build/src/screens/CountryCode/type.js +0 -1
  74. package/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +0 -46
  75. package/build/src/screens/CreatePassword/index.js +0 -16
  76. package/build/src/screens/CreatePassword/index.native.js +0 -32
  77. package/build/src/screens/CreatePassword/type.js +0 -1
  78. package/build/src/screens/EnterEmail/hooks/internal/useEnterEmail.js +0 -77
  79. package/build/src/screens/EnterEmail/index.js +0 -58
  80. package/build/src/screens/EnterEmail/index.native.js +0 -31
  81. package/build/src/screens/EnterEmail/types.js +0 -1
  82. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.js +0 -36
  83. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.js +0 -33
  84. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.native.js +0 -73
  85. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/types.js +0 -1
  86. package/build/src/screens/EnterMobile/hooks/internal/useEnterMobile.js +0 -67
  87. package/build/src/screens/EnterMobile/index.js +0 -81
  88. package/build/src/screens/EnterMobile/index.native.js +0 -56
  89. package/build/src/screens/EnterMobile/types.js +0 -1
  90. package/build/src/screens/EnterPassword/hooks/internal/useEnterPassword.js +0 -79
  91. package/build/src/screens/EnterPassword/index.js +0 -68
  92. package/build/src/screens/EnterPassword/index.native.js +0 -41
  93. package/build/src/screens/EnterPassword/types.js +0 -1
  94. package/build/src/screens/Login/components/LoginWebComponent/index.js +0 -63
  95. package/build/src/screens/Login/components/LoginWebComponent/index.native.js +0 -6
  96. package/build/src/screens/Login/index.js +0 -10
  97. package/build/src/screens/Login/index.native.js +0 -6
  98. package/build/src/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.js +0 -85
  99. package/build/src/screens/LoginWithEmailOTP/index.js +0 -8
  100. package/build/src/screens/LoginWithEmailOTP/index.native.js +0 -10
  101. package/build/src/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.js +0 -72
  102. package/build/src/screens/LoginWithMobileOTP/index.js +0 -8
  103. package/build/src/screens/LoginWithMobileOTP/index.native.js +0 -10
  104. package/build/src/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.js +0 -77
  105. package/build/src/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.js +0 -50
  106. package/build/src/screens/PartnerSSO/PartnerLogin/index.js +0 -2
  107. package/build/src/screens/PartnerSSO/PartnerLogin/types.js +0 -1
  108. package/build/src/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.js +0 -203
  109. package/build/src/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.js +0 -90
  110. package/build/src/screens/PartnerSSO/PartnerRegistration/index.js +0 -2
  111. package/build/src/screens/PartnerSSO/PartnerRegistration/types.js +0 -1
  112. package/build/src/screens/PartnerSSO/index.js +0 -2
  113. package/build/src/screens/Profile/components/EditMobileNumber/index.js +0 -31
  114. package/build/src/screens/Profile/components/EditMobileNumber/index.native.js +0 -8
  115. package/build/src/screens/Profile/components/EditPassword/index.js +0 -29
  116. package/build/src/screens/Profile/components/EditPassword/index.native.js +0 -8
  117. package/build/src/screens/Profile/components/EditProfile/index.js +0 -89
  118. package/build/src/screens/Profile/components/EditProfile/index.native.js +0 -8
  119. package/build/src/screens/Profile/components/OtpVerificationModal/index.js +0 -61
  120. package/build/src/screens/Profile/components/OtpVerificationModal/index.native.js +0 -7
  121. package/build/src/screens/Profile/components/ProfileWebComponent/index.js +0 -80
  122. package/build/src/screens/Profile/components/ProfileWebComponent/index.native.js +0 -9
  123. package/build/src/screens/Profile/hooks/internal/useProfile.js +0 -185
  124. package/build/src/screens/Profile/index.js +0 -6
  125. package/build/src/screens/Profile/index.native.js +0 -6
  126. package/build/src/screens/Profile/types.js +0 -1
  127. package/build/src/screens/ResetPassword/hooks/internal/useResetPassword.js +0 -57
  128. package/build/src/screens/ResetPassword/index.js +0 -46
  129. package/build/src/screens/ResetPassword/index.native.js +0 -26
  130. package/build/src/screens/ResetPassword/types.js +0 -1
  131. package/build/src/screens/SSOLogin/AuthWebView/index.js +0 -9
  132. package/build/src/screens/SSOLogin/AuthWebView/index.native.js +0 -42
  133. package/build/src/screens/SSOLogin/AuthWebView/types.js +0 -1
  134. package/build/src/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.js +0 -39
  135. package/build/src/screens/SSOLogin/AuthenticationMethods/index.js +0 -50
  136. package/build/src/screens/SSOLogin/AuthenticationMethods/index.native.js +0 -59
  137. package/build/src/screens/SSOLogin/AuthenticationMethods/types.js +0 -1
  138. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.js +0 -87
  139. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.js +0 -6
  140. package/build/src/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.js +0 -58
  141. package/build/src/screens/SSOLogin/SSOCallback/index.js +0 -9
  142. package/build/src/screens/SSOLogin/SSOCallback/index.native.js +0 -35
  143. package/build/src/screens/SSOLogin/SSOCallback/types.js +0 -1
  144. package/build/src/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.js +0 -71
  145. package/build/src/screens/SSOLogin/SearchOrganization/index.js +0 -46
  146. package/build/src/screens/SSOLogin/SearchOrganization/index.native.js +0 -37
  147. package/build/src/screens/SSOLogin/SearchOrganization/types.js +0 -1
  148. package/build/src/screens/SignUp/components/SignUpForm/index.js +0 -215
  149. package/build/src/screens/SignUp/components/SignUpForm/index.native.js +0 -6
  150. package/build/src/screens/SignUp/components/SignUpForm/type.js +0 -1
  151. package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +0 -62
  152. package/build/src/screens/SignUp/components/SignUpWebComponent/index.native.js +0 -6
  153. package/build/src/screens/SignUp/components/SignUpWebComponent/types.js +0 -1
  154. package/build/src/screens/SignUp/hooks/internal/useSignUp.js +0 -134
  155. package/build/src/screens/SignUp/index.js +0 -6
  156. package/build/src/screens/SignUp/index.native.js +0 -188
  157. package/build/src/screens/SignUp/types.js +0 -1
  158. package/build/src/screens/UserConsent/hooks/internal/useConsent.js +0 -64
  159. package/build/src/screens/UserConsent/index.js +0 -93
  160. package/build/src/screens/UserConsent/index.native.js +0 -47
  161. package/build/src/screens/UserConsent/types.js +0 -1
  162. package/build/src/screens/VerifyEmail/hooks/internal/useVerifyEmail.js +0 -69
  163. package/build/src/screens/VerifyEmail/index.js +0 -8
  164. package/build/src/screens/VerifyEmail/index.native.js +0 -14
  165. package/build/src/screens/VerifyEmail/types.js +0 -1
  166. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.js +0 -73
  167. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.js +0 -8
  168. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.js +0 -14
  169. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/types.js +0 -1
  170. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.js +0 -83
  171. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.js +0 -8
  172. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.js +0 -10
  173. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/types.js +0 -1
  174. package/build/src/screens/VerifyMobile/hooks/internal/useVerifyMobile.js +0 -74
  175. package/build/src/screens/VerifyMobile/index.js +0 -8
  176. package/build/src/screens/VerifyMobile/index.native.js +0 -9
  177. package/build/src/screens/VerifyMobile/types.js +0 -1
  178. package/build/src/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.js +0 -74
  179. package/build/src/screens/VerifyResetPasswordOTP/index.js +0 -8
  180. package/build/src/screens/VerifyResetPasswordOTP/index.native.js +0 -14
  181. package/build/src/screens/Welcome/SocialAuth/commonSocialAuth.js +0 -127
  182. package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.js +0 -187
  183. package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.js +0 -13
  184. package/build/src/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.js +0 -115
  185. package/build/src/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.js +0 -72
  186. package/build/src/screens/Welcome/components/SocialLoginModal/index.js +0 -9
  187. package/build/src/screens/Welcome/components/SocialLoginModal/index.native.js +0 -21
  188. package/build/src/screens/Welcome/components/SocialLoginModal/types.js +0 -1
  189. package/build/src/screens/Welcome/hooks/internal/useWelcome.js +0 -26
  190. package/build/src/screens/Welcome/index.js +0 -28
  191. package/build/src/screens/Welcome/index.native.js +0 -78
  192. package/build/src/types/types.js +0 -2
  193. package/build/types/api/auth.d.ts +0 -11
  194. package/build/types/api/axiosClient/index.d.ts +0 -1
  195. package/build/types/api/axiosClient/index.native.d.ts +0 -1
  196. package/build/types/components/AdvancedTransitionWrapper/index.d.ts +0 -3
  197. package/build/types/components/AdvancedTransitionWrapper/index.native.d.ts +0 -5
  198. package/build/types/components/AdvancedTransitionWrapper/types.d.ts +0 -25
  199. package/build/types/components/ConfirmationModal/index.d.ts +0 -3
  200. package/build/types/components/ConfirmationModal/index.native.d.ts +0 -3
  201. package/build/types/components/ConfirmationModal/types.d.ts +0 -16
  202. package/build/types/components/IonIcon/index.d.ts +0 -3
  203. package/build/types/components/IonIcon/index.native.d.ts +0 -4
  204. package/build/types/components/IonIcon/types.d.ts +0 -6
  205. package/build/types/components/OTPStatusLabel/index.d.ts +0 -2
  206. package/build/types/components/OTPStatusLabel/index.native.d.ts +0 -3
  207. package/build/types/components/OTPStatusLabel/types.d.ts +0 -6
  208. package/build/types/components/PasswordCriteria/hooks/usePasswordCriteria.d.ts +0 -8
  209. package/build/types/components/PasswordCriteria/index.d.ts +0 -3
  210. package/build/types/components/PasswordCriteria/index.native.d.ts +0 -3
  211. package/build/types/components/PasswordCriteria/types.d.ts +0 -15
  212. package/build/types/components/ScreenLayout/index.d.ts +0 -3
  213. package/build/types/components/ScreenLayout/index.native.d.ts +0 -3
  214. package/build/types/components/ScreenLayout/types.d.ts +0 -13
  215. package/build/types/components/SupportDetails/index.d.ts +0 -2
  216. package/build/types/components/SupportDetails/index.native.d.ts +0 -2
  217. package/build/types/components/VerifyEmailOTP/index.d.ts +0 -3
  218. package/build/types/components/VerifyEmailOTP/index.native.d.ts +0 -3
  219. package/build/types/components/VerifyEmailOTP/types.d.ts +0 -9
  220. package/build/types/components/VerifyMobileOTP/index.d.ts +0 -3
  221. package/build/types/components/VerifyMobileOTP/index.native.d.ts +0 -3
  222. package/build/types/components/VerifyMobileOTP/types.d.ts +0 -9
  223. package/build/types/constants/base-url/index.d.ts +0 -1
  224. package/build/types/constants/base-url/index.native.d.ts +0 -1
  225. package/build/types/constants/cdn-url/index.d.ts +0 -2
  226. package/build/types/constants/cdn-url/index.native.d.ts +0 -3
  227. package/build/types/constants/defaultPolicy.d.ts +0 -9
  228. package/build/types/constants/password-requirements.d.ts +0 -4
  229. package/build/types/constants/social-login-options.d.ts +0 -3
  230. package/build/types/contexts/AuthContext.d.ts +0 -38
  231. package/build/types/contexts/type.d.ts +0 -94
  232. package/build/types/enums/index.d.ts +0 -3
  233. package/build/types/enums/loginMethod.enum.d.ts +0 -7
  234. package/build/types/enums/registrationMethod.enum.d.ts +0 -6
  235. package/build/types/enums/socialLogins.enum.d.ts +0 -5
  236. package/build/types/helpers/network.d.ts +0 -5
  237. package/build/types/helpers/show-message/index.d.ts +0 -3
  238. package/build/types/helpers/show-message/index.native.d.ts +0 -3
  239. package/build/types/helpers/show-message/types.d.ts +0 -6
  240. package/build/types/helpers/types.d.ts +0 -19
  241. package/build/types/helpers/validation.d.ts +0 -2
  242. package/build/types/hooks/internal/useAuthPackageContext.d.ts +0 -1
  243. package/build/types/hooks/internal/useTimer.d.ts +0 -3
  244. package/build/types/hooks/useAuthContext.d.ts +0 -2
  245. package/build/types/hooks/useNavigator.d.ts +0 -66
  246. package/build/types/hooks/useRequest.d.ts +0 -5
  247. package/build/types/index.d.ts +0 -15
  248. package/build/types/navigator/index.d.ts +0 -2
  249. package/build/types/navigator/index.native.d.ts +0 -82
  250. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.d.ts +0 -3
  251. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.native.d.ts +0 -2
  252. package/build/types/screens/CountryCode/components/CountryCodeDropdown/types.d.ts +0 -17
  253. package/build/types/screens/CountryCode/hooks/internal/useCountryCode.d.ts +0 -12
  254. package/build/types/screens/CountryCode/index.d.ts +0 -2
  255. package/build/types/screens/CountryCode/index.native.d.ts +0 -2
  256. package/build/types/screens/CountryCode/type.d.ts +0 -11
  257. package/build/types/screens/CreatePassword/hooks/internal/useCreatePassword.d.ts +0 -37
  258. package/build/types/screens/CreatePassword/index.d.ts +0 -3
  259. package/build/types/screens/CreatePassword/index.native.d.ts +0 -4
  260. package/build/types/screens/CreatePassword/type.d.ts +0 -43
  261. package/build/types/screens/EnterEmail/hooks/internal/useEnterEmail.d.ts +0 -19
  262. package/build/types/screens/EnterEmail/index.d.ts +0 -3
  263. package/build/types/screens/EnterEmail/index.native.d.ts +0 -4
  264. package/build/types/screens/EnterEmail/types.d.ts +0 -13
  265. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.d.ts +0 -13
  266. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.d.ts +0 -3
  267. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.native.d.ts +0 -3
  268. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/types.d.ts +0 -28
  269. package/build/types/screens/EnterMobile/hooks/internal/useEnterMobile.d.ts +0 -15
  270. package/build/types/screens/EnterMobile/index.d.ts +0 -4
  271. package/build/types/screens/EnterMobile/index.native.d.ts +0 -4
  272. package/build/types/screens/EnterMobile/types.d.ts +0 -44
  273. package/build/types/screens/EnterPassword/hooks/internal/useEnterPassword.d.ts +0 -25
  274. package/build/types/screens/EnterPassword/index.d.ts +0 -3
  275. package/build/types/screens/EnterPassword/index.native.d.ts +0 -4
  276. package/build/types/screens/EnterPassword/types.d.ts +0 -24
  277. package/build/types/screens/Login/components/LoginWebComponent/index.d.ts +0 -2
  278. package/build/types/screens/Login/components/LoginWebComponent/index.native.d.ts +0 -2
  279. package/build/types/screens/Login/index.d.ts +0 -2
  280. package/build/types/screens/Login/index.native.d.ts +0 -2
  281. package/build/types/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.d.ts +0 -17
  282. package/build/types/screens/LoginWithEmailOTP/index.d.ts +0 -7
  283. package/build/types/screens/LoginWithEmailOTP/index.native.d.ts +0 -4
  284. package/build/types/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.d.ts +0 -11
  285. package/build/types/screens/LoginWithMobileOTP/index.d.ts +0 -5
  286. package/build/types/screens/LoginWithMobileOTP/index.native.d.ts +0 -4
  287. package/build/types/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.d.ts +0 -25
  288. package/build/types/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.d.ts +0 -8
  289. package/build/types/screens/PartnerSSO/PartnerLogin/index.d.ts +0 -2
  290. package/build/types/screens/PartnerSSO/PartnerLogin/types.d.ts +0 -35
  291. package/build/types/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.d.ts +0 -24
  292. package/build/types/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.d.ts +0 -8
  293. package/build/types/screens/PartnerSSO/PartnerRegistration/index.d.ts +0 -2
  294. package/build/types/screens/PartnerSSO/PartnerRegistration/types.d.ts +0 -63
  295. package/build/types/screens/PartnerSSO/index.d.ts +0 -2
  296. package/build/types/screens/Profile/components/EditMobileNumber/index.d.ts +0 -6
  297. package/build/types/screens/Profile/components/EditMobileNumber/index.native.d.ts +0 -3
  298. package/build/types/screens/Profile/components/EditPassword/index.d.ts +0 -6
  299. package/build/types/screens/Profile/components/EditPassword/index.native.d.ts +0 -3
  300. package/build/types/screens/Profile/components/EditProfile/index.d.ts +0 -6
  301. package/build/types/screens/Profile/components/EditProfile/index.native.d.ts +0 -3
  302. package/build/types/screens/Profile/components/OtpVerificationModal/index.d.ts +0 -4
  303. package/build/types/screens/Profile/components/OtpVerificationModal/index.native.d.ts +0 -3
  304. package/build/types/screens/Profile/components/ProfileWebComponent/index.d.ts +0 -4
  305. package/build/types/screens/Profile/components/ProfileWebComponent/index.native.d.ts +0 -3
  306. package/build/types/screens/Profile/hooks/internal/useProfile.d.ts +0 -26
  307. package/build/types/screens/Profile/index.d.ts +0 -7
  308. package/build/types/screens/Profile/index.native.d.ts +0 -7
  309. package/build/types/screens/Profile/types.d.ts +0 -53
  310. package/build/types/screens/ResetPassword/hooks/internal/useResetPassword.d.ts +0 -29
  311. package/build/types/screens/ResetPassword/index.d.ts +0 -3
  312. package/build/types/screens/ResetPassword/index.native.d.ts +0 -4
  313. package/build/types/screens/ResetPassword/types.d.ts +0 -11
  314. package/build/types/screens/SSOLogin/AuthWebView/index.d.ts +0 -2
  315. package/build/types/screens/SSOLogin/AuthWebView/index.native.d.ts +0 -4
  316. package/build/types/screens/SSOLogin/AuthWebView/types.d.ts +0 -8
  317. package/build/types/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.d.ts +0 -9
  318. package/build/types/screens/SSOLogin/AuthenticationMethods/index.d.ts +0 -3
  319. package/build/types/screens/SSOLogin/AuthenticationMethods/index.native.d.ts +0 -4
  320. package/build/types/screens/SSOLogin/AuthenticationMethods/types.d.ts +0 -14
  321. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.d.ts +0 -6
  322. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.d.ts +0 -2
  323. package/build/types/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.d.ts +0 -15
  324. package/build/types/screens/SSOLogin/SSOCallback/index.d.ts +0 -2
  325. package/build/types/screens/SSOLogin/SSOCallback/index.native.d.ts +0 -4
  326. package/build/types/screens/SSOLogin/SSOCallback/types.d.ts +0 -14
  327. package/build/types/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.d.ts +0 -18
  328. package/build/types/screens/SSOLogin/SearchOrganization/index.d.ts +0 -3
  329. package/build/types/screens/SSOLogin/SearchOrganization/index.native.d.ts +0 -4
  330. package/build/types/screens/SSOLogin/SearchOrganization/types.d.ts +0 -13
  331. package/build/types/screens/SignUp/components/SignUpForm/index.d.ts +0 -3
  332. package/build/types/screens/SignUp/components/SignUpForm/index.native.d.ts +0 -2
  333. package/build/types/screens/SignUp/components/SignUpForm/type.d.ts +0 -6
  334. package/build/types/screens/SignUp/components/SignUpWebComponent/index.d.ts +0 -2
  335. package/build/types/screens/SignUp/components/SignUpWebComponent/index.native.d.ts +0 -2
  336. package/build/types/screens/SignUp/components/SignUpWebComponent/types.d.ts +0 -9
  337. package/build/types/screens/SignUp/hooks/internal/useSignUp.d.ts +0 -48
  338. package/build/types/screens/SignUp/index.d.ts +0 -2
  339. package/build/types/screens/SignUp/index.native.d.ts +0 -4
  340. package/build/types/screens/SignUp/types.d.ts +0 -40
  341. package/build/types/screens/UserConsent/hooks/internal/useConsent.d.ts +0 -10
  342. package/build/types/screens/UserConsent/index.d.ts +0 -3
  343. package/build/types/screens/UserConsent/index.native.d.ts +0 -4
  344. package/build/types/screens/UserConsent/types.d.ts +0 -33
  345. package/build/types/screens/VerifyEmail/hooks/internal/useVerifyEmail.d.ts +0 -19
  346. package/build/types/screens/VerifyEmail/index.d.ts +0 -3
  347. package/build/types/screens/VerifyEmail/index.native.d.ts +0 -4
  348. package/build/types/screens/VerifyEmail/types.d.ts +0 -8
  349. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.d.ts +0 -15
  350. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.d.ts +0 -3
  351. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.d.ts +0 -4
  352. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/types.d.ts +0 -14
  353. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.d.ts +0 -17
  354. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.d.ts +0 -3
  355. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.d.ts +0 -4
  356. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/types.d.ts +0 -5
  357. package/build/types/screens/VerifyMobile/hooks/internal/useVerifyMobile.d.ts +0 -14
  358. package/build/types/screens/VerifyMobile/index.d.ts +0 -3
  359. package/build/types/screens/VerifyMobile/index.native.d.ts +0 -4
  360. package/build/types/screens/VerifyMobile/types.d.ts +0 -5
  361. package/build/types/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.d.ts +0 -19
  362. package/build/types/screens/VerifyResetPasswordOTP/index.d.ts +0 -7
  363. package/build/types/screens/VerifyResetPasswordOTP/index.native.d.ts +0 -4
  364. package/build/types/screens/Welcome/SocialAuth/commonSocialAuth.d.ts +0 -50
  365. package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.d.ts +0 -7
  366. package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.d.ts +0 -7
  367. package/build/types/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.d.ts +0 -5
  368. package/build/types/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.d.ts +0 -4
  369. package/build/types/screens/Welcome/components/SocialLoginModal/index.d.ts +0 -3
  370. package/build/types/screens/Welcome/components/SocialLoginModal/index.native.d.ts +0 -3
  371. package/build/types/screens/Welcome/components/SocialLoginModal/types.d.ts +0 -8
  372. package/build/types/screens/Welcome/hooks/internal/useWelcome.d.ts +0 -22
  373. package/build/types/screens/Welcome/index.d.ts +0 -4
  374. package/build/types/screens/Welcome/index.native.d.ts +0 -4
  375. package/build/types/types/types.d.ts +0 -115
@@ -1,81 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Flex, Form, ResponsiveModal, TextInput, Typography, useForm } from '@truworth/twc-web-design';
3
- import { ScreenLayout } from "../../components/ScreenLayout";
4
- import { useEnterMobile } from "./hooks/internal/useEnterMobile";
5
- import { CountryCodeDropdown } from '../CountryCode/components/CountryCodeDropdown';
6
- import { useNavigator } from '../../hooks/useNavigator';
7
- import { useState } from 'react';
8
- import { ExistingAccountsSheet } from './components/ExistingAccountsSheet';
9
- import LoginWithMobileOTP from '../LoginWithMobileOTP';
10
- import VerifyLinkPrimaryAccountEmailOTP from '../VerifyLinkPrimaryAccountEmailOTP';
11
- import VerifyLinkPrimaryAccountMobileOTP from '../VerifyLinkPrimaryAccountMobileOTP';
12
- import { RegistrationMethod } from '../../enums';
13
- const EnterMobile = ({ onPressBack }) => {
14
- const [showLoginWithMobileOTPModal, setShowLoginWithMobileOTPModal] = useState(false);
15
- const [showVerifyLinkPrimaryEmailModal, setShowVerifyLinkPrimaryEmailModal] = useState(false);
16
- const [showVerifyLinkPrimaryMobileModal, setShowVerifyLinkPrimaryMobileModal] = useState(false);
17
- const [email, setEmail] = useState('');
18
- const [sessionToken, setSessionToken] = useState('');
19
- const [selectedCountry, setSelectedCountry] = useState({
20
- countryCode: "in",
21
- phoneCode: "91",
22
- name: "INDIA",
23
- });
24
- const form = useForm();
25
- const navigator = useNavigator();
26
- const { loading, phone, isValidPhone, countryCode, setCountryCode, existingAccounts, showExistingAccountsSheet, setShowExistingAccountsSheet, handleValidatePhone, handleEnterMobile, } = useEnterMobile();
27
- const handleSubmit = () => {
28
- handleValidatePhone({
29
- onValidate: ({ mobileExist, email }) => {
30
- if (mobileExist && email) {
31
- setEmail(email);
32
- setShowLoginWithMobileOTPModal(true);
33
- }
34
- else {
35
- navigator.pushAbsolute('/registration', {
36
- query: { phone, registrationMethod: RegistrationMethod.MOBILE }
37
- });
38
- }
39
- }
40
- });
41
- };
42
- return (_jsxs(ScreenLayout, { title: "Enter Your Mobile Number", buttonProps: {
43
- loading,
44
- label: 'Continue',
45
- onClick: handleSubmit,
46
- disabled: !isValidPhone,
47
- }, onPressBack: onPressBack, children: [_jsx(Form, { className: "w-full", form: form, onSubmit: handleSubmit, children: _jsx(Form.Item, { label: "Mobile Number", className: "my-6", rules: [
48
- {
49
- required: true,
50
- message: 'Please enter your mobile number'
51
- }
52
- ], ...form.register("phone", {
53
- onChange: (e) => handleEnterMobile(e.target.value)
54
- }), children: _jsx(Flex, { className: "border border-gray-400 rounded-md", children: _jsx(TextInput, { type: "tel", value: phone, placeholder: "Mobile number", maxLength: countryCode === "91" ? 10 : 14, className: "py-4 border-0 md:text-base", addonBefore: _jsx(CountryCodeDropdown, { selectedCountry: selectedCountry, handleSelect: (country) => {
55
- setCountryCode(country.phoneCode);
56
- setSelectedCountry(country);
57
- } }) }) }) }) }), showLoginWithMobileOTPModal &&
58
- _jsx(LoginWithMobileOTPModal, { email: email, phone: phone, show: showLoginWithMobileOTPModal, hide: () => setShowLoginWithMobileOTPModal(false) }), showExistingAccountsSheet &&
59
- _jsx(ExistingAccountsSheet, { phone: phone, visible: showExistingAccountsSheet, existingAccounts: existingAccounts, onInitiateAccountLinking: ({ sessionToken, email }) => {
60
- setSessionToken(sessionToken);
61
- setEmail(email);
62
- setShowExistingAccountsSheet(false);
63
- setShowVerifyLinkPrimaryEmailModal(true);
64
- }, hide: () => setShowExistingAccountsSheet(false) }), showVerifyLinkPrimaryEmailModal &&
65
- _jsx(VerifyLinkPrimaryAccountEmailOTPModal, { email: email, sessionToken: sessionToken, show: showVerifyLinkPrimaryEmailModal, hide: () => setShowVerifyLinkPrimaryEmailModal(false), onVerifiedOTP: ({ sessionToken }) => {
66
- setSessionToken(sessionToken);
67
- setShowVerifyLinkPrimaryEmailModal(false);
68
- setShowVerifyLinkPrimaryMobileModal(true);
69
- } }), showVerifyLinkPrimaryMobileModal &&
70
- _jsx(VerifyLinkPrimaryAccountMobileOTPModal, { phone: phone, sessionToken: sessionToken, show: showVerifyLinkPrimaryMobileModal, hide: () => setShowVerifyLinkPrimaryMobileModal(false) })] }));
71
- };
72
- const VerifyLinkPrimaryAccountEmailOTPModal = ({ show, hide, email, sessionToken, onVerifiedOTP }) => {
73
- return (_jsx(ResponsiveModal, { title: "Verify Email", open: show, onClose: hide, maskClosable: false, showCloseButton: false, size: 'sm', children: _jsx(VerifyLinkPrimaryAccountEmailOTP, { email: email, sessionToken: sessionToken, onVerifiedOTP: onVerifiedOTP }) }));
74
- };
75
- const VerifyLinkPrimaryAccountMobileOTPModal = ({ show, hide, phone, sessionToken }) => {
76
- return (_jsx(ResponsiveModal, { title: "Verify Mobile Number", open: show, onClose: hide, maskClosable: false, showCloseButton: false, size: 'sm', children: _jsx(VerifyLinkPrimaryAccountMobileOTP, { phone: phone, sessionToken: sessionToken }) }));
77
- };
78
- const LoginWithMobileOTPModal = ({ show, hide, email, phone }) => {
79
- return (_jsx(ResponsiveModal, { open: show, onClose: hide, title: _jsx(Typography, { type: "heading", size: "h6", className: "text-center mb-0", children: "Verify Mobile Number" }), showCloseButton: false, maskClosable: false, size: 'sm', children: _jsx(LoginWithMobileOTP, { phone: phone, email: email }) }));
80
- };
81
- export default EnterMobile;
@@ -1,56 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRoute } from '@react-navigation/native';
3
- import { Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
4
- import { Colors } from '@truworth/twc-rn-common';
5
- import { Layout } from '@ui-kitten/components';
6
- import { useEffect } from 'react';
7
- import IonIcons from 'react-native-vector-icons/Ionicons';
8
- import { ScreenLayout } from '../../components/ScreenLayout';
9
- import { useEnterMobile } from './hooks/internal/useEnterMobile';
10
- import { ExistingAccountsSheet } from './components/ExistingAccountsSheet/index.native';
11
- const { gray, primary } = Colors;
12
- const EnterMobile = ({ navigation }) => {
13
- const route = useRoute();
14
- const { loading, phone, isValidPhone, countryCode, setCountryCode, existingAccounts, showExistingAccountsSheet, setShowExistingAccountsSheet, handleValidatePhone, handleEnterMobile, handleClearPhoneInput } = useEnterMobile();
15
- useEffect(() => {
16
- if (route.params?.countryCode) {
17
- setCountryCode(route.params?.countryCode);
18
- }
19
- }, [route.params?.countryCode]);
20
- const changeCountryCode = () => {
21
- navigation.navigate('CountryCode', { prevRoute: 'EnterMobile' });
22
- };
23
- const handleSubmit = () => {
24
- Keyboard.dismiss();
25
- handleValidatePhone({
26
- onValidate: ({ mobileExist, email }) => {
27
- if (mobileExist && email) {
28
- navigation.navigate('LoginWithMobileOTP', {
29
- phone,
30
- email
31
- });
32
- }
33
- else {
34
- navigation.navigate('SignUp', { phone });
35
- }
36
- }
37
- });
38
- };
39
- return (_jsxs(Layout, { style: { flex: 1, backgroundColor: '#FFFFFF' }, children: [_jsx(ScreenLayout, { title: "Enter Your Mobile Number", buttonProps: {
40
- loading,
41
- label: 'Continue',
42
- onPress: handleSubmit,
43
- disabled: !isValidPhone,
44
- }, children: _jsxs(View, { style: {
45
- flexDirection: 'row', alignItems: 'center',
46
- borderWidth: 1, borderRadius: 8,
47
- paddingHorizontal: 12, height: 56,
48
- backgroundColor: primary.white, marginTop: 4,
49
- }, children: [_jsxs(TouchableOpacity, { activeOpacity: 0.8, onPress: changeCountryCode, style: { flexDirection: 'row', alignItems: 'center' }, children: [_jsx(Text, { style: { fontSize: 14, color: primary.black, fontWeight: '500' }, children: `+${countryCode}` }), _jsx(IonIcons, { name: 'caret-down', size: 14, color: gray.gray_900 })] }), _jsx(TextInput, { style: {
50
- flex: 1, fontSize: 14, fontWeight: '500',
51
- color: primary.black, marginLeft: 2,
52
- }, onChangeText: text => handleEnterMobile(text), value: phone, keyboardType: "numeric", maxLength: countryCode === '91' ? 10 : 14, autoFocus: true }), phone.length > 0 &&
53
- _jsx(TouchableOpacity, { activeOpacity: 0.8, onPress: handleClearPhoneInput, children: _jsx(IonIcons, { name: 'close', size: 24, color: gray.gray_900 }) })] }) }), showExistingAccountsSheet &&
54
- _jsx(ExistingAccountsSheet, { phone: phone, visible: showExistingAccountsSheet, existingAccounts: existingAccounts, hide: () => setShowExistingAccountsSheet(false) })] }));
55
- };
56
- export default EnterMobile;
@@ -1 +0,0 @@
1
- export {};
@@ -1,79 +0,0 @@
1
- import { useState, useCallback, useMemo } from "react";
2
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
3
- import { axiosClient } from "../../../../api/axiosClient";
4
- import { showMessage } from "../../../../helpers/show-message";
5
- /**
6
- * @internal
7
- * Hook for managing Enter Password screen logic and authentication integration.
8
- */
9
- const useEnterPassword = () => {
10
- const [password, setPassword] = useState("");
11
- const [isPasswordVisible, setIsPasswordVisible] = useState(false);
12
- const [invalidPassword, setInvalidPassword] = useState(false);
13
- const [loading, setLoading] = useState(false);
14
- const { onTokenChange, onLogin, appConfig } = useAuthPackageContext();
15
- const togglePasswordVisibility = useCallback(() => {
16
- setIsPasswordVisible((prev) => !prev);
17
- }, []);
18
- const handlePasswordChange = useCallback((value) => {
19
- setInvalidPassword(false);
20
- setPassword(value);
21
- }, []);
22
- const handleSubmit = useCallback(async ({ email, source, verifyEmailOTP }) => {
23
- setLoading(true);
24
- try {
25
- const response = await axiosClient.post("/auth/login/v2", {
26
- email,
27
- password,
28
- source,
29
- });
30
- // Check if MFA is enabled
31
- if (response.data.mfaEnabled && response.data.sessionToken) {
32
- // Navigate to LoginWithEmailOTP screen with sessionToken
33
- if (verifyEmailOTP) {
34
- verifyEmailOTP({
35
- mfaEnabled: response.data.mfaEnabled,
36
- sessionToken: response.data.sessionToken
37
- });
38
- }
39
- setLoading(false);
40
- return;
41
- }
42
- // Normal login flow (no MFA)
43
- if (response.data.token) {
44
- onTokenChange(response.data.token);
45
- onLogin(response.data);
46
- }
47
- }
48
- catch (error) {
49
- const errorMessage = error?.response?.data?.errors?.[0]?.message;
50
- if (error?.response?.status === 400) {
51
- setInvalidPassword(true);
52
- if (source === 'web') {
53
- showMessage({ message: errorMessage ?? 'Email and password do not match!' });
54
- }
55
- return;
56
- }
57
- showMessage({ message: errorMessage ?? 'Something went wrong. Please try again.' });
58
- }
59
- finally {
60
- setLoading(false);
61
- }
62
- }, [password, onTokenChange, onLogin]);
63
- const isDisabled = useMemo(() => {
64
- return password?.length === 0 || loading;
65
- }, [password, loading]);
66
- return {
67
- loading,
68
- password,
69
- setPassword,
70
- isPasswordVisible,
71
- togglePasswordVisibility,
72
- handleSubmit,
73
- isDisabled,
74
- handlePasswordChange,
75
- appName: appConfig.appName,
76
- invalidPassword
77
- };
78
- };
79
- export { useEnterPassword };
@@ -1,68 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { Button, Flex, Form, PasswordInput, ResponsiveModal, Typography, useForm } from '@truworth/twc-web-design';
4
- import { ScreenLayout } from "../../components/ScreenLayout";
5
- import { useEnterPassword } from './hooks/internal/useEnterPassword';
6
- import { SupportDetails } from '../../components/SupportDetails';
7
- import LoginWithEmailOTP from '../LoginWithEmailOTP';
8
- import VerifyResetPasswordOTP from '../VerifyResetPasswordOTP';
9
- const EnterPassword = ({ email, onPressBack, onVerifiedResetPasswordOTP }) => {
10
- const [showResetPasswordOTPModal, setShowResetPasswordOTPModal] = useState(false);
11
- const [showLoginWithEmailOTPModal, setShowLoginWithEmailOTPModal] = useState(false);
12
- const [mfaSessionToken, setMfaSessionToken] = useState(undefined);
13
- const [mfaEnabled, setMfaEnabled] = useState(false);
14
- const { loading, password, handlePasswordChange, handleSubmit, appName } = useEnterPassword();
15
- const form = useForm({ defaultValues: { password } });
16
- return (_jsxs(_Fragment, { children: [_jsxs(ScreenLayout, { title: `Hi, Welcome To ${appName}!`, subTitle: email, buttonProps: {
17
- loading,
18
- label: 'Continue',
19
- onClick: () => {
20
- if (email)
21
- handleSubmit({
22
- email,
23
- source: 'web',
24
- verifyEmailOTP: ({ mfaEnabled, sessionToken }) => {
25
- setMfaSessionToken(sessionToken);
26
- setMfaEnabled(mfaEnabled);
27
- setShowLoginWithEmailOTPModal(true);
28
- }
29
- });
30
- },
31
- disabled: !password || !email || loading,
32
- }, onPressBack: onPressBack, children: [_jsx(Form, { className: "w-full", form: form, onSubmit: () => {
33
- if (email)
34
- handleSubmit({
35
- email,
36
- source: 'web',
37
- verifyEmailOTP: ({ mfaEnabled, sessionToken }) => {
38
- setMfaSessionToken(sessionToken);
39
- setMfaEnabled(mfaEnabled);
40
- setShowLoginWithEmailOTPModal(true);
41
- }
42
- });
43
- }, children: _jsx(Form.Item, { name: "password", label: "Password", children: _jsx(PasswordInput, { placeholder: "Enter your password", value: password, showStrengthIndicator: false, className: `border rounded-md px-3 py-2 border-gray-300`, ...form.register('password', {
44
- onChange: (e) => {
45
- handlePasswordChange(e.target.value);
46
- }
47
- }) }) }) }), _jsx(Button, { type: "button", size: 'small', variant: 'link', label: "Forgot Password?", className: "px-0 h-auto ml-auto block mt-4", onClick: () => setShowResetPasswordOTPModal(true) })] }), _jsxs(Flex, { align: "center", className: "mt-6 mb-6", children: [_jsx(Flex, { className: "flex-1 border-t border-gray-300" }), _jsx(Typography, { type: 'body', size: 'small', className: "text-gray-500 px-4", children: "OR" }), _jsx(Flex, { className: "flex-1 border-t border-gray-300" })] }), _jsx(Button, { label: 'Sign In with Email OTP', variant: 'secondary', className: 'flex-none', isFullWidth: true, type: "button", onClick: () => {
48
- setMfaSessionToken(undefined);
49
- setMfaEnabled(false);
50
- setShowLoginWithEmailOTPModal(true);
51
- } }), _jsx(SupportDetails, {}), showResetPasswordOTPModal &&
52
- _jsx(VerifyResetPasswordOTPModal, { email: email, show: showResetPasswordOTPModal, hide: () => setShowResetPasswordOTPModal(false), onVerifiedOTP: (sessionToken) => {
53
- setShowResetPasswordOTPModal(false);
54
- onVerifiedResetPasswordOTP(sessionToken);
55
- } }), showLoginWithEmailOTPModal &&
56
- _jsx(LoginWithEmailOTPModal, { email: email, password: password, sessionToken: mfaSessionToken, mfaEnabled: mfaEnabled, show: showLoginWithEmailOTPModal, hide: () => {
57
- setShowLoginWithEmailOTPModal(false);
58
- setMfaSessionToken(undefined);
59
- setMfaEnabled(false);
60
- } })] }));
61
- };
62
- const LoginWithEmailOTPModal = ({ show, hide, email, password, sessionToken, mfaEnabled }) => {
63
- return (_jsx(ResponsiveModal, { open: show, onClose: hide, title: _jsx(Typography, { type: "heading", size: "h6", className: "text-center mb-0", children: "Verify Your Email" }), showCloseButton: false, maskClosable: false, size: 'sm', children: _jsx(LoginWithEmailOTP, { email: email, password: password, sessionToken: sessionToken, mfaEnabled: mfaEnabled }) }));
64
- };
65
- const VerifyResetPasswordOTPModal = ({ show, hide, email, onVerifiedOTP }) => {
66
- return (_jsx(ResponsiveModal, { title: "Reset Your Password", open: show, onClose: hide, maskClosable: false, showCloseButton: false, size: 'sm', children: _jsx(VerifyResetPasswordOTP, { email: email, onVerifiedOTP: onVerifiedOTP }) }));
67
- };
68
- export default EnterPassword;
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { View, Text, Platform, TouchableOpacity } from 'react-native';
3
- import { RoundedButton, TextInputField, Colors } from '@truworth/twc-rn-common';
4
- import { Layout } from '@ui-kitten/components';
5
- import { ScreenLayout } from '../../components/ScreenLayout/index.native';
6
- import { useEnterPassword } from './hooks/internal/useEnterPassword';
7
- const { primary } = Colors;
8
- const EnterPassword = ({ navigation, route }) => {
9
- const { email } = route.params;
10
- const { loading, password, isPasswordVisible, togglePasswordVisibility, handlePasswordChange, isDisabled, handleSubmit, invalidPassword } = useEnterPassword();
11
- return (_jsxs(Layout, { style: { flex: 1, backgroundColor: primary.white }, children: [_jsxs(ScreenLayout, { title: "Enter Your Password", buttonProps: {
12
- loading,
13
- label: 'Continue',
14
- onPress: () => {
15
- if (email)
16
- handleSubmit({
17
- email,
18
- source: Platform.OS,
19
- verifyEmailOTP: ({ mfaEnabled, sessionToken }) => {
20
- navigation.navigate('LoginWithEmailOTP', { email, password, mfaEnabled, sessionToken });
21
- }
22
- });
23
- },
24
- disabled: isDisabled,
25
- }, children: [_jsx(View, { style: { position: 'relative' }, children: _jsx(TextInputField, { placeholder: 'Enter password...', onChangeValue: handlePasswordChange, secureTextEntry: !isPasswordVisible, value: password, rightIcon2: isPasswordVisible ? 'eye-outline' : 'eye-off-outline', onPressRightIcon2: () => togglePasswordVisibility(), error: {
26
- show: invalidPassword,
27
- message: 'Email and password do not match!'
28
- }, autoFocus: true }) }), _jsx(TouchableOpacity, { activeOpacity: 0.8, style: { marginTop: 10, alignSelf: 'flex-end' }, onPress: () => navigation.navigate('VerifyResetPasswordOTP', { email }), children: _jsx(Text, { style: {
29
- fontSize: 12, fontWeight: '600',
30
- color: primary.primary_main, lineHeight: 20,
31
- }, children: "Forgot Password?" }) })] }), _jsxs(View, { style: { paddingHorizontal: 16 }, children: [_jsxs(View, { style: {
32
- flexDirection: 'row', justifyContent: 'center',
33
- alignItems: 'center', marginBottom: 14, marginTop: 14,
34
- }, children: [_jsx(View, { style: { width: 12, height: 1, backgroundColor: '#7F7F7F' } }), _jsx(Text, { style: {
35
- fontSize: 12, fontWeight: '600', color: '#7F7F7F',
36
- lineHeight: 20, textAlign: 'center',
37
- marginHorizontal: 6,
38
- }, children: "OR" }), _jsx(View, { style: { width: 12, height: 1, backgroundColor: '#7F7F7F' } })] }), email &&
39
- _jsx(RoundedButton, { type: "text", size: "medium", label: "Sign In with Email OTP", onPress: () => navigation.navigate('LoginWithEmailOTP', { email }) })] })] }));
40
- };
41
- export default EnterPassword;
@@ -1 +0,0 @@
1
- export {};
@@ -1,63 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useState } from 'react';
3
- import { Flex } from '@truworth/twc-web-design';
4
- import { AdvancedTransitionWrapper } from '../../../../components/AdvancedTransitionWrapper';
5
- import { useAuthPackageContext } from '../../../../hooks/internal/useAuthPackageContext';
6
- import { useNavigator } from '../../../../hooks/useNavigator';
7
- import EnterEmail from '../../../EnterEmail/index';
8
- import EnterPassword from '../../../EnterPassword/index';
9
- import ResetPassword from '../../../ResetPassword/index';
10
- import SSOSearchOrganization from '../../../SSOLogin/SearchOrganization/index';
11
- import SSOAuthenticationMethods from '../../../SSOLogin/AuthenticationMethods/index';
12
- import EnterMobile from '../../../../screens/EnterMobile/index';
13
- const LoginWebComponent = () => {
14
- const [email, setEmail] = useState('');
15
- const [loginState, setLoginState] = useState('EnterEmail');
16
- const [sessionToken, setSessionToken] = useState('');
17
- const [selectedClient, setSelectedClient] = useState(null);
18
- const { LogoComponent } = useAuthPackageContext();
19
- const navigator = useNavigator();
20
- const onRedirectToPassword = (email) => {
21
- setEmail(email);
22
- setLoginState('EnterPassword');
23
- };
24
- const onRedirectToSignUp = (email) => {
25
- navigator.pushAbsolute('/registration', {
26
- query: { email, registrationMethod: 'email' }
27
- });
28
- };
29
- const renderStep = () => {
30
- switch (loginState) {
31
- case 'EnterEmail':
32
- return (_jsx(EnterEmail, { onContinue: (params) => {
33
- if (params.emailExist) {
34
- onRedirectToPassword(params.email);
35
- }
36
- else {
37
- onRedirectToSignUp(params.email);
38
- }
39
- }, onPressSignInWithSSO: () => setLoginState('SSOSearchOrganization') }));
40
- case 'EnterPassword':
41
- return (_jsx(EnterPassword, { email: email, onPressBack: () => setLoginState('EnterEmail'), onVerifiedResetPasswordOTP: ({ sessionToken }) => {
42
- setSessionToken(sessionToken);
43
- setLoginState('ResetPassword');
44
- } }));
45
- case 'ResetPassword':
46
- return (_jsx(ResetPassword, { email: email, sessionToken: sessionToken, onContinue: () => setLoginState('EnterEmail'), onPressBack: () => setLoginState('EnterPassword') }));
47
- case 'SSOSearchOrganization':
48
- return (_jsx(SSOSearchOrganization, { onPressBack: () => setLoginState('EnterEmail'), onContinue: (client) => {
49
- setSelectedClient(client);
50
- setLoginState('SSOAuthenticationMethods');
51
- } }));
52
- case 'SSOAuthenticationMethods':
53
- return selectedClient && (_jsx(SSOAuthenticationMethods, { client: selectedClient, onPressBack: () => setLoginState('EnterEmail'), handleMobileLogin: () => setLoginState('EnterMobile') }));
54
- case 'EnterMobile':
55
- return (_jsx(EnterMobile, { onPressBack: () => setLoginState('SSOAuthenticationMethods') }));
56
- default:
57
- return null;
58
- }
59
- };
60
- return (_jsx(AdvancedTransitionWrapper, { type: 'slide', duration: 0.5, children: _jsxs(Flex, { direction: 'column', justify: 'center', className: `lg:w-[70%] lg:h-screen mx-auto h-full my-10`, children: [React.isValidElement(LogoComponent)
61
- && LogoComponent, renderStep()] }) }));
62
- };
63
- export { LoginWebComponent };
@@ -1,6 +0,0 @@
1
- const LoginWebComponent = () => {
2
- if (__DEV__)
3
- console.warn("[@truworth/twc-auth] LoginWebComponent is web-only");
4
- return null;
5
- };
6
- export { LoginWebComponent };
@@ -1,10 +0,0 @@
1
- 'use client';
2
- const Login = () => {
3
- if (process.env.NODE_ENV !== 'production') {
4
- if (typeof window !== 'undefined') {
5
- console.warn("[@truworth/twc-auth] We use only LoginWebComponent for login");
6
- }
7
- }
8
- return null;
9
- };
10
- export default Login;
@@ -1,6 +0,0 @@
1
- const Login = () => {
2
- if (__DEV__)
3
- console.warn("[@truworth/twc-auth] we use only LoginWebComponent for login");
4
- return null;
5
- };
6
- export default Login;
@@ -1,85 +0,0 @@
1
- import { useCallback, useEffect, useRef, useState } from "react";
2
- import { showMessage } from "../../../../helpers/show-message";
3
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
4
- import { axiosClient } from "../../../../api/axiosClient";
5
- /**
6
- * @internal
7
- * Hook for handling Email OTP Login flow.
8
- */
9
- const useLoginWithEmailOTP = ({ email, password, source, sessionToken, mfaEnabled }) => {
10
- const [resendOTPCounter, setResendOTPCounter] = useState(0);
11
- const [status, setStatus] = useState("idle");
12
- const sessionTokenRef = useRef(sessionToken || "");
13
- const { onLogin, onTokenChange } = useAuthPackageContext();
14
- /**
15
- * Sends an OTP to the provided email.
16
- */
17
- const sendOtp = useCallback(() => {
18
- setStatus("loading");
19
- const payload = { email, source };
20
- if (password && mfaEnabled) {
21
- payload.password = password;
22
- }
23
- axiosClient({
24
- url: mfaEnabled ? '/auth/login/v2' : '/auth/login/email',
25
- method: 'POST',
26
- data: payload
27
- }).then((res) => {
28
- setResendOTPCounter(prevCounter => prevCounter + 1);
29
- sessionTokenRef.current = res.data.sessionToken;
30
- }).catch((error) => {
31
- console.log('Failed to send OTP:', error);
32
- const message = error?.response?.data?.errors?.[0]?.message || "Failed to send OTP. Please try again.";
33
- showMessage({ message });
34
- }).finally(() => setStatus("idle"));
35
- }, [email, source, password, mfaEnabled]);
36
- /**
37
- * Verifies the entered OTP and logs the user in.
38
- */
39
- const verifyOtp = useCallback((otp) => {
40
- setStatus("loading");
41
- axiosClient({
42
- url: '/auth/login/email/verify-otp',
43
- method: 'POST',
44
- data: { otp, sessionToken: sessionTokenRef.current },
45
- }).then((res) => {
46
- setStatus('valid');
47
- const { token, member } = res.data;
48
- onTokenChange(token);
49
- onLogin({ token, member });
50
- }).catch((error) => {
51
- const errorCode = error?.response?.status;
52
- const isInvalidOtp = errorCode === 400;
53
- const message = error?.response?.data?.errors?.[0]?.message ||
54
- (isInvalidOtp
55
- ? "Invalid OTP. Please try again."
56
- : "Verification failed. Please try again.");
57
- showMessage({ message });
58
- setStatus(isInvalidOtp ? "invalid" : "idle");
59
- if (isInvalidOtp) {
60
- const timeoutId = setTimeout(() => setStatus("idle"), 5000);
61
- return () => clearTimeout(timeoutId);
62
- }
63
- });
64
- }, [onLogin, onTokenChange]);
65
- /**
66
- * Automatically sends OTP when email and source are provided.
67
- * Skip if mfaEnabled & sessionToken is already provided (from MFA flow).
68
- */
69
- useEffect(() => {
70
- if (email && source && !mfaEnabled) {
71
- sendOtp();
72
- }
73
- else if (mfaEnabled && sessionToken) {
74
- // If sessionToken is provided, we already have a session, just initialize
75
- sessionTokenRef.current = sessionToken;
76
- }
77
- }, [email, source, sessionToken, sendOtp]);
78
- return {
79
- sendOtp,
80
- verifyOtp,
81
- resendOTPCounter,
82
- status,
83
- };
84
- };
85
- export { useLoginWithEmailOTP };
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useLoginWithEmailOTP } from "./hooks/internal/useLoginWithEmailOTP";
3
- import { VerifyEmailOTP } from "../../components/VerifyEmailOTP";
4
- const LoginWithEmailOTP = ({ email, password, sessionToken, mfaEnabled }) => {
5
- const { resendOTPCounter, status, verifyOtp, sendOtp, } = useLoginWithEmailOTP({ email, password, source: 'web', sessionToken, mfaEnabled });
6
- return (_jsx(VerifyEmailOTP, { email: email, validateOTP: verifyOtp, resendOTP: sendOtp, status: status, resendOTPCounter: resendOTPCounter }));
7
- };
8
- export default LoginWithEmailOTP;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Platform } from 'react-native';
3
- import { VerifyEmailOTP } from '../../components/VerifyEmailOTP';
4
- import { useLoginWithEmailOTP } from './hooks/internal/useLoginWithEmailOTP';
5
- const LoginWithEmailOTP = ({ route }) => {
6
- const { email, sessionToken, mfaEnabled, password } = route.params;
7
- const { resendOTPCounter, status, verifyOtp, sendOtp, } = useLoginWithEmailOTP({ email, password, source: Platform.OS, sessionToken, mfaEnabled });
8
- return (_jsx(VerifyEmailOTP, { email: email, status: status, validateOTP: verifyOtp, resendOTP: sendOtp, resendOTPCounter: resendOTPCounter }));
9
- };
10
- export default LoginWithEmailOTP;
@@ -1,72 +0,0 @@
1
- import { useCallback, useEffect, useState } from "react";
2
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
3
- import { axiosClient } from "../../../../api/axiosClient";
4
- import { useInterval } from "../../../../hooks/internal/useTimer";
5
- import { showMessage } from "../../../../helpers/show-message";
6
- const useLoginWithMobileOTP = ({ phone, email, source }) => {
7
- const [timer, setTimer] = useState(180);
8
- const [status, setStatus] = useState('timer');
9
- const [sessionToken, setSessionToken] = useState('');
10
- const { onLogin, onTokenChange } = useAuthPackageContext();
11
- useInterval(() => {
12
- if (!timer) {
13
- return;
14
- }
15
- setTimer(timer - 1);
16
- }, 1000);
17
- const sendOtp = useCallback(() => {
18
- setStatus('loading');
19
- axiosClient({
20
- url: '/auth/login/mobile/v2',
21
- method: 'POST',
22
- data: { phone, email, source },
23
- }).then((res) => {
24
- setSessionToken(res.data.sessionToken);
25
- setStatus('timer');
26
- setTimer(180);
27
- }).catch((err) => {
28
- console.log(err);
29
- showMessage({ message: err.response.data.errors[0].message || "Verification failed" });
30
- });
31
- }, [phone, email, source]);
32
- const verifyOtp = useCallback((otp) => {
33
- if (!sessionToken) {
34
- showMessage({ message: "Session expired. Please resend OTP." });
35
- return;
36
- }
37
- setStatus('loading');
38
- axiosClient({
39
- url: '/auth/login/mobile/v2/verify-otp',
40
- method: 'POST',
41
- data: { otp, sessionToken },
42
- }).then((res) => {
43
- setStatus('valid');
44
- const { token, member } = res.data;
45
- onTokenChange(token);
46
- onLogin({ token, member });
47
- }).catch((error) => {
48
- const errorCode = error?.response?.status;
49
- const isInvalidOtp = errorCode === 400;
50
- const message = error?.response?.data?.errors?.[0]?.message ||
51
- (isInvalidOtp
52
- ? "Invalid OTP. Please try again."
53
- : "Verification failed. Please try again.");
54
- showMessage({ message });
55
- setStatus(isInvalidOtp ? "invalid" : "idle");
56
- if (isInvalidOtp)
57
- setTimeout(() => setStatus("idle"), 5000);
58
- });
59
- }, [sessionToken]);
60
- useEffect(() => {
61
- if (email && source) {
62
- sendOtp();
63
- }
64
- }, [email, source, sendOtp]);
65
- return {
66
- timer,
67
- status,
68
- verifyOtp,
69
- sendOtp,
70
- };
71
- };
72
- export { useLoginWithMobileOTP };
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { VerifyMobileOTP } from '../../components/VerifyMobileOTP';
3
- import { useLoginWithMobileOTP } from './hooks/internal/useLoginWithMobileOTP';
4
- const LoginWithMobileOTP = ({ phone, email }) => {
5
- const { timer, status, verifyOtp, sendOtp, } = useLoginWithMobileOTP({ phone, email, source: 'web' });
6
- return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: verifyOtp, resendOTP: sendOtp }));
7
- };
8
- export default LoginWithMobileOTP;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { VerifyMobileOTP } from '../../components/VerifyMobileOTP';
3
- import { useLoginWithMobileOTP } from './hooks/internal/useLoginWithMobileOTP';
4
- import { Platform } from 'react-native';
5
- const LoginWithMobileOTP = ({ route }) => {
6
- const { phone, email } = route.params;
7
- const { timer, status, verifyOtp, sendOtp, } = useLoginWithMobileOTP({ phone, email, source: Platform.OS });
8
- return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: verifyOtp, resendOTP: sendOtp }));
9
- };
10
- export default LoginWithMobileOTP;