@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,6 +0,0 @@
1
- const CountryCodeDropdown = () => {
2
- if (__DEV__)
3
- console.warn("[@truworth/twc-auth] CountryCodeDropdown is web-only");
4
- return null;
5
- };
6
- export { CountryCodeDropdown };
@@ -1,38 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { axiosClient } from "../../../../api/axiosClient";
3
- /**
4
- * @internal
5
- * Internal hook for managing CountryCode screen state and auth context integration.
6
- * Not exposed to package consumers.
7
- */
8
- const useCountryCode = () => {
9
- const [countryCodes, setCountryCodes] = useState([]);
10
- const [searchCountry, setSearchCountry] = useState([]);
11
- useEffect(() => {
12
- if (countryCodes.length === 0) {
13
- getCountryCodes();
14
- }
15
- }, []);
16
- const getCountryCodes = () => {
17
- axiosClient({
18
- url: '/auth/country-codes',
19
- method: 'GET',
20
- }).then((res) => {
21
- setCountryCodes(res.data);
22
- }).catch((err) => {
23
- console.log(err);
24
- });
25
- };
26
- const onSearch = (text) => {
27
- let query = text.toLowerCase();
28
- let filtered = countryCodes.filter((item) => item.name.toLowerCase().includes(query));
29
- if (!query || query === '') {
30
- setSearchCountry([]);
31
- }
32
- else {
33
- setSearchCountry(filtered);
34
- }
35
- };
36
- return { countryCodes, searchCountry, onSearch };
37
- };
38
- export { useCountryCode };
@@ -1,10 +0,0 @@
1
- 'use client';
2
- const CountryCode = () => {
3
- if (process.env.NODE_ENV !== 'production') {
4
- if (typeof window !== 'undefined') {
5
- console.warn("[@truworth/twc-auth] We use only CountryCode for app");
6
- }
7
- }
8
- return null;
9
- };
10
- export default CountryCode;
@@ -1,37 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { TextInput, Text, View, Image, FlatList, TouchableOpacity } from 'react-native';
3
- import { Icon, Layout } from '@ui-kitten/components';
4
- import { Colors, withPreventDoubleTap } from '@truworth/twc-rn-common';
5
- import { useNavigation, useRoute } from '@react-navigation/native';
6
- import { useCountryCode } from './hooks/internal/useCountryCode';
7
- import { useState } from 'react';
8
- const TouchableCard = withPreventDoubleTap(TouchableOpacity);
9
- const { primary, gray } = Colors;
10
- const CountryCode = () => {
11
- const [isSearching, setIsSearching] = useState(false);
12
- const route = useRoute();
13
- const navigation = useNavigation();
14
- const { countryCodes, searchCountry, onSearch } = useCountryCode();
15
- const onSelect = (countryCode, iconCode) => {
16
- navigation.navigate(route.params?.prevRoute, {
17
- ...route.params,
18
- countryCode,
19
- iconCode,
20
- });
21
- };
22
- return (_jsxs(Layout, { style: { flex: 1, backgroundColor: primary.white }, children: [_jsxs(View, { style: { flexDirection: 'row' }, children: [_jsx(TouchableCard, { style: { flexDirection: 'row', paddingHorizontal: 15, alignSelf: 'center' }, activeOpacity: 0.8, onPress: () => navigation.goBack(), children: _jsx(Icon, { name: "arrow-back", fill: "#313131", style: { width: 25, height: 25 } }) }), _jsxs(View, { style: {
23
- flex: 1, backgroundColor: '#eeeef0', height: 45,
24
- flexDirection: 'row', alignItems: 'center', borderRadius: 10,
25
- marginVertical: 15, paddingHorizontal: 10, marginRight: 15,
26
- }, children: [_jsx(Icon, { fill: "#8F9BB3", style: { height: 28, width: 28 }, name: "search-outline" }), _jsx(TextInput, { style: { fontSize: 16, flex: 1, color: primary.black }, placeholder: "Search Country", placeholderTextColor: gray.gray_400, onChangeText: text => {
27
- onSearch(text);
28
- setIsSearching(text.trim().length > 0);
29
- } })] })] }), _jsx(View, { style: { borderBottomWidth: 1, borderBottomColor: '#ddd' } }), _jsx(FlatList, { data: isSearching ? searchCountry : countryCodes, keyExtractor: (item) => item.id.toString(), renderItem: ({ item }) => {
30
- const sanitizedCountryCode = (item.countryCode ?? '').replace(/[^a-zA-Z]/g, '').toLowerCase();
31
- return (_jsxs(TouchableOpacity, { style: { flexDirection: 'row', paddingHorizontal: 15, paddingTop: 20, alignItems: 'center' }, onPress: () => onSelect(item.phoneCode, item.countryCode), children: [_jsx(Image, { source: { uri: `https://cdn.thewellnesscorner.com/country-flags/${sanitizedCountryCode}.png` }, style: { height: 25, width: 40 }, resizeMode: "cover" }), _jsx(Text, { style: {
32
- flex: 1, textTransform: 'uppercase',
33
- fontSize: 18, color: primary.black, marginLeft: 15,
34
- }, children: `${item.name} (+${item.phoneCode})` })] }));
35
- } })] }));
36
- };
37
- export default CountryCode;
@@ -1 +0,0 @@
1
- export {};
@@ -1,46 +0,0 @@
1
- import { useState } from "react";
2
- import { defaultPolicy } from "../../../../constants/defaultPolicy";
3
- /**
4
- * @internal
5
- * Internal hook for managing CreatePassword screen state and auth context integration.
6
- * Not exposed to package consumers.
7
- *
8
- * Both web and native use the same pattern:
9
- * - Hook manages password state internally
10
- * - Use handlePassword/handleConfirmPassword to update state
11
- * - Optional initial values for preserving state when navigating back
12
- */
13
- const useCreatePassword = (props) => {
14
- const [passwordVisible, setPasswordVisible] = useState(false);
15
- const [confirmPasswordVisible, setConfirmPasswordVisible] = useState(false);
16
- const [password, setPassword] = useState(props?.initialPassword || '');
17
- const [confirmPassword, setConfirmPassword] = useState(props?.initialConfirmPassword || '');
18
- const [maxLength, setMaxLength] = useState(defaultPolicy.maxLength);
19
- const [criteria, setCriteria] = useState({});
20
- const handlePassword = (text) => {
21
- setPassword(text.replace(/\s/g, ''));
22
- };
23
- const handleConfirmPassword = (text) => {
24
- setConfirmPassword(text.replace(/\s/g, ''));
25
- };
26
- const handleSkip = ({ onResult }) => {
27
- setPassword('');
28
- setConfirmPassword('');
29
- onResult();
30
- };
31
- const allCriteriaMet = Object.keys(criteria).length > 0 && Object.keys(criteria).every(c => criteria[c]);
32
- const passwordsMatch = password.length > 0 && password === confirmPassword;
33
- const isContinueDisabled = !allCriteriaMet || !passwordsMatch;
34
- return {
35
- password, setPassword,
36
- confirmPassword, setConfirmPassword,
37
- passwordVisible, setPasswordVisible,
38
- confirmPasswordVisible, setConfirmPasswordVisible,
39
- maxLength, setMaxLength,
40
- criteria, setCriteria,
41
- handlePassword, handleConfirmPassword,
42
- handleSkip,
43
- isContinueDisabled
44
- };
45
- };
46
- export { useCreatePassword };
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, Flex, PasswordInput, Typography } from "@truworth/twc-web-design";
3
- import { useCreatePassword } from "./hooks/internal/useCreatePassword";
4
- import { ScreenLayout } from "../../components/ScreenLayout";
5
- import { PasswordCriteria } from "../../components/PasswordCriteria";
6
- const CreatePassword = ({ userDetails, handleBack, onContinue }) => {
7
- const { countryCode, email } = userDetails;
8
- const { password, confirmPassword, handlePassword, handleConfirmPassword, passwordVisible, setPasswordVisible, confirmPasswordVisible, setConfirmPasswordVisible, criteria, setCriteria, maxLength, setMaxLength, handleSkip, isContinueDisabled } = useCreatePassword();
9
- return (_jsx(ScreenLayout, { title: _jsxs(Flex, { justify: "between", align: "center", children: [_jsx(Typography, { type: "heading", size: "h5", children: "Create your Password" }), countryCode == '91' &&
10
- _jsx(Button, { label: "Skip Now", variant: "link", onClick: () => handleSkip({ onResult: () => onContinue('', '') }) })] }), subTitle: "Use a password that's easy to remember and fulfills all the requirements listed below.", buttonProps: {
11
- label: 'Continue',
12
- onClick: () => onContinue(password, confirmPassword),
13
- disabled: isContinueDisabled
14
- }, onPressBack: handleBack, children: _jsxs("div", { style: { width: '100%' }, children: [_jsxs("div", { style: { marginBottom: '8px', width: '100%' }, children: [_jsx(Typography, { type: "body", size: "small", className: "mb-1 font-medium", children: "Enter Password" }), _jsx("div", { style: { width: '100%' }, children: _jsx(PasswordInput, { placeholder: "Enter password", value: password, onChange: (value) => handlePassword(value), maxLength: maxLength, showStrengthIndicator: false, style: { width: '100%' } }) })] }), _jsx(PasswordCriteria, { email: email, password: password, criteria: criteria, onCriteriaChange: setCriteria, onMaxLengthChange: setMaxLength }), _jsxs("div", { style: { marginTop: '24px', marginBottom: '24px', width: '100%' }, children: [_jsx(Typography, { type: "body", size: "small", className: "mb-1 font-medium", children: "Confirm Password" }), _jsx("div", { style: { width: '100%' }, children: _jsx(PasswordInput, { placeholder: "Re-enter password", value: confirmPassword, onChange: (value) => handleConfirmPassword(value), maxLength: maxLength, showStrengthIndicator: false, style: { width: '100%' } }) }), confirmPassword && password !== confirmPassword && (_jsx(Typography, { type: "body", size: "tiny", className: "text-red-500 mt-1", children: "Passwords don't match" }))] })] }) }));
15
- };
16
- export default CreatePassword;
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Keyboard, Text, TouchableOpacity } from 'react-native';
3
- import { Colors, TextInputField } from '@truworth/twc-rn-common';
4
- import { Layout } from '@ui-kitten/components';
5
- import { ScreenLayout } from '../../components/ScreenLayout';
6
- import { useCreatePassword } from './hooks/internal/useCreatePassword';
7
- import { PasswordCriteria } from '../../components/PasswordCriteria/index.native';
8
- const { primary } = Colors;
9
- const CreatePassword = ({ navigation, route }) => {
10
- const { countryCode, email } = route.params;
11
- const { password, confirmPassword, passwordVisible, setPasswordVisible, confirmPasswordVisible, setConfirmPasswordVisible, maxLength, setMaxLength, criteria, setCriteria, handlePassword, handleConfirmPassword, handleSkip, isContinueDisabled } = useCreatePassword();
12
- const onContinue = () => {
13
- navigation.navigate('UserConsent', { ...route.params, password });
14
- };
15
- return (_jsx(Layout, { style: { flex: 1, backgroundColor: primary.white }, children: _jsxs(ScreenLayout, { title: "Create your Password", subTitle: "Use a password that\u2019s easy to remember and fulfills all the requirement listed below.", buttonProps: {
16
- label: 'Continue',
17
- onPress: onContinue,
18
- disabled: isContinueDisabled,
19
- }, accessoryRight: countryCode == '91'
20
- ? _jsx(TouchableOpacity, { activeOpacity: 0.8, onPress: () => {
21
- Keyboard.dismiss();
22
- handleSkip({
23
- onResult: () => {
24
- navigation.navigate('UserConsent', { ...route.params });
25
- }
26
- });
27
- }, children: _jsx(Text, { style: { fontSize: 16, fontWeight: '600', color: primary.primary_main }, children: "Skip" }) })
28
- : _jsx(_Fragment, {}), children: [_jsx(TextInputField, { placeholder: "Enter password...", onChangeValue: handlePassword, secureTextEntry: !passwordVisible, value: password, rightIcon2: passwordVisible
29
- ? 'eye-outline'
30
- : 'eye-off-outline', onPressRightIcon2: () => setPasswordVisible(!passwordVisible), autoFocus: true, maxLength: maxLength }), _jsx(PasswordCriteria, { email: email, password: password, criteria: criteria, onCriteriaChange: setCriteria, onMaxLengthChange: setMaxLength }), _jsx(TextInputField, { placeholder: "Confirm password...", onChangeValue: handleConfirmPassword, secureTextEntry: !confirmPasswordVisible, value: confirmPassword, rightIcon2: confirmPasswordVisible ? 'eye-outline' : 'eye-off-outline', onPressRightIcon2: () => setConfirmPasswordVisible(!confirmPasswordVisible), maxLength: maxLength, containerStyle: { marginTop: 16 } })] }) }));
31
- };
32
- export default CreatePassword;
@@ -1 +0,0 @@
1
- export {};
@@ -1,77 +0,0 @@
1
- import { useState, useCallback } from "react";
2
- import { showMessage } from "../../../../helpers/show-message";
3
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
4
- import { checkEmailExists } from "../../../../api/auth";
5
- import { LoginMethodCode, RegistrationMethod } from "../../../../enums";
6
- const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
7
- /**
8
- * @internal
9
- * Hook for managing Enter Email screen logic and authentication integration.
10
- */
11
- const useEnterEmail = () => {
12
- const [email, setEmail] = useState("");
13
- const [loginType, setLoginType] = useState("");
14
- const [loading, setLoading] = useState(false);
15
- const [isEmailValid, setIsEmailValid] = useState(false);
16
- const [isLoginConflictModalVisible, setIsLoginConflictModalVisible] = useState(false);
17
- const { appConfig, onRegistrationMethodChange } = useAuthPackageContext();
18
- /**
19
- * Handles email input change with validation
20
- */
21
- const handleEmailChange = useCallback((value) => {
22
- const normalizedEmail = value.toLowerCase().trim();
23
- setEmail(normalizedEmail);
24
- setIsEmailValid(EMAIL_REGEX.test(normalizedEmail));
25
- }, []);
26
- /**
27
- * Validates email existence and handles login conflicts
28
- */
29
- const handleEmailExists = useCallback(async ({ onValidate }) => {
30
- setLoading(true);
31
- try {
32
- const { emailExist, loginType } = await checkEmailExists(email);
33
- const loginCode = Number(loginType);
34
- if (emailExist && loginCode !== LoginMethodCode.Email) {
35
- const loginMethodMap = {
36
- [LoginMethodCode.Facebook]: "Facebook",
37
- [LoginMethodCode.Google]: "Google",
38
- [LoginMethodCode.Apple]: "Apple",
39
- [LoginMethodCode.SSO]: "SSO",
40
- };
41
- setLoginType(loginMethodMap[loginCode] || "your social account");
42
- setIsLoginConflictModalVisible(true);
43
- return;
44
- }
45
- onRegistrationMethodChange(RegistrationMethod.EMAIL);
46
- onValidate({ emailExist });
47
- }
48
- catch (error) {
49
- const message = error?.response?.data?.errors?.[0]?.message ?? "Something went wrong";
50
- showMessage({ message });
51
- }
52
- finally {
53
- setLoading(false);
54
- }
55
- }, [email]);
56
- /**
57
- * Clears email input field
58
- */
59
- const handleClearEmail = useCallback(() => {
60
- setEmail("");
61
- setIsEmailValid(false);
62
- }, []);
63
- return {
64
- email,
65
- isEmailValid,
66
- loading,
67
- handleEmailChange,
68
- handleEmailExists,
69
- handleClearEmail,
70
- isLoginConflictModalVisible,
71
- setIsLoginConflictModalVisible,
72
- appName: appConfig.appName,
73
- loginConflictTitle: `Sign in with ${loginType}`,
74
- loginConflictDescription: `Looks like you previously registered using ${loginType}. Please go back and sign in with ${loginType}.`,
75
- };
76
- };
77
- export { useEnterEmail };
@@ -1,58 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, Flex, Form, TextInput, Typography, useForm } from '@truworth/twc-web-design';
3
- import { ConfirmationModal as LoginConflictModal } from '../../components/ConfirmationModal';
4
- import { ScreenLayout } from "../../components/ScreenLayout";
5
- import { useEnterEmail } from "./hooks/internal/useEnterEmail";
6
- import { SupportDetails } from '../../components/SupportDetails';
7
- import { useWelcome } from '../Welcome/hooks/internal/useWelcome';
8
- import { socialLoginOptions } from '../../constants/social-login-options';
9
- import { SocialLoginModal } from '../Welcome/components/SocialLoginModal';
10
- import { useSocialAuth } from '../Welcome/SocialAuth/hooks/useSocialAuth.web';
11
- import { SocialLoginsEnum } from '../../enums';
12
- import _ from 'lodash';
13
- const EnterEmail = ({ onContinue, onPressSignInWithSSO }) => {
14
- const { loginWithGoogle, loginWithFacebook } = useSocialAuth();
15
- const { email, isEmailValid, handleEmailChange, appName, handleEmailExists, loading, loginConflictTitle, loginConflictDescription, isLoginConflictModalVisible, setIsLoginConflictModalVisible, } = useEnterEmail();
16
- const { showSocialLoginModal, setShowSocialLoginModal, socialLoginType, setSocialLoginType, isSocialLoginEnabled, socialLoginConfig, } = useWelcome();
17
- const form = useForm({ defaultValues: { email } });
18
- const handleLogin = () => {
19
- setShowSocialLoginModal(false);
20
- switch (socialLoginType) {
21
- case SocialLoginsEnum.Google:
22
- return loginWithGoogle();
23
- case SocialLoginsEnum.Facebook:
24
- return loginWithFacebook();
25
- default:
26
- return;
27
- }
28
- };
29
- return (_jsxs(_Fragment, { children: [_jsxs(ScreenLayout, { title: `Hi, Welcome To ${appName}!`, subTitle: "Please enter email to get started.", buttonProps: {
30
- loading,
31
- label: 'Continue',
32
- onClick: () => {
33
- handleEmailExists({
34
- onValidate: ({ emailExist }) => onContinue({ email, emailExist })
35
- });
36
- },
37
- disabled: !isEmailValid,
38
- }, children: [_jsx(Form, { className: "w-full", form: form, onSubmit: () => {
39
- handleEmailExists({
40
- onValidate: ({ emailExist }) => onContinue({ email, emailExist })
41
- });
42
- }, children: _jsx(Form.Item, { name: "email", label: "Email", children: _jsx(TextInput, { type: "email", value: email, size: "medium", placeholder: "example@domain", ...form.register('email', {
43
- onChange: (e) => {
44
- handleEmailChange(e.target.value);
45
- }
46
- }) }) }) }), isLoginConflictModalVisible &&
47
- _jsx(LoginConflictModal, { title: loginConflictTitle, description: loginConflictDescription, visible: isLoginConflictModalVisible, onProceed: () => setIsLoginConflictModalVisible(false), onClose: () => setIsLoginConflictModalVisible(false), primaryLabel: 'Okay' })] }), _jsx(Button, { isFullWidth: true, type: "button", label: 'Sign In with SSO', variant: 'secondary', className: 'flex-none mt-6', onClick: onPressSignInWithSSO }), isSocialLoginEnabled && (_jsxs(_Fragment, { children: [_jsxs(Flex, { align: "center", className: "my-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 continue with" }), _jsx(Flex, { className: "flex-1 border-t border-gray-300" })] }), _jsx(Flex, { justify: 'center', align: 'center', className: "gap-4", children: socialLoginOptions.map(({ type, iconImageUrl }) => {
48
- if (type === SocialLoginsEnum.Apple) {
49
- return null;
50
- }
51
- return socialLoginConfig?.[type]?.enabled && (_jsxs("button", { type: "button", className: "flex justify-center p-3 gap-2 items-center\n rounded-[50px] flex-1 border text-gray-800 hover:text-gray-800\n border-gray-100 bg-gray-100 hover:border-gray-300 transition-all duration-300 cursor-pointer", onClick: () => {
52
- setSocialLoginType(type);
53
- setShowSocialLoginModal(true);
54
- }, children: [_jsx("img", { src: iconImageUrl, style: { width: 20, height: 20 } }), _jsx(Typography, { type: 'utility', size: 'medium', children: _.startCase(type) })] }, type));
55
- }) })] })), showSocialLoginModal &&
56
- _jsx(SocialLoginModal, { visible: showSocialLoginModal, hide: () => setShowSocialLoginModal(false), socialLoginType: socialLoginType, onClick: handleLogin }), _jsx(SupportDetails, {})] }));
57
- };
58
- export default EnterEmail;
@@ -1,31 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Keyboard } from 'react-native';
3
- import { Layout } from '@ui-kitten/components';
4
- import { Colors, TextInputField } from '@truworth/twc-rn-common';
5
- import { useEnterEmail } from './hooks/internal/useEnterEmail';
6
- import { ScreenLayout } from '../../components/ScreenLayout/index.native';
7
- import { ConfirmationModal as LoginConflictModal } from '../../components/ConfirmationModal';
8
- import { RegistrationMethod } from '../../enums';
9
- const { utility } = Colors;
10
- const EnterEmail = ({ navigation }) => {
11
- const { email, isEmailValid, handleEmailChange, handleClearEmail, handleEmailExists, loading, loginConflictTitle, loginConflictDescription, isLoginConflictModalVisible, setIsLoginConflictModalVisible } = useEnterEmail();
12
- const onValidate = (params) => {
13
- if (params.emailExist) {
14
- navigation.navigate('EnterPassword', { email });
15
- }
16
- else {
17
- navigation.navigate('SignUp', { email });
18
- }
19
- };
20
- return (_jsxs(Layout, { style: { flex: 1, backgroundColor: '#FFFFFF' }, children: [_jsx(ScreenLayout, { title: "Enter Your Email", buttonProps: {
21
- loading,
22
- label: 'Continue',
23
- onPress: () => {
24
- Keyboard.dismiss();
25
- handleEmailExists({ onValidate });
26
- },
27
- disabled: !isEmailValid,
28
- }, children: _jsx(TextInputField, { value: email, placeholder: 'Enter here...', onChangeValue: handleEmailChange, rightIcon2: email.length > 0 ? 'close' : '', onPressRightIcon2: handleClearEmail, autoFocus: true, autoCapitalize: 'none', keyboardType: 'email-address' }) }), isLoginConflictModalVisible &&
29
- _jsx(LoginConflictModal, { title: loginConflictTitle, description: loginConflictDescription, visible: isLoginConflictModalVisible, onProceed: () => setIsLoginConflictModalVisible(false), onClose: () => setIsLoginConflictModalVisible(false), iconColor: utility.warning_main, primaryLabel: 'Okay' })] }));
30
- };
31
- export default EnterEmail;
@@ -1 +0,0 @@
1
- export {};
@@ -1,36 +0,0 @@
1
- import { useCallback, useState } from "react";
2
- import { axiosClient } from '../../../../../../api/axiosClient';
3
- import { showMessage } from "../../../../../../helpers/show-message";
4
- /**
5
- * @internal
6
- * Internal hook for managing useExistingAccountsSheet hook state and auth context integration. Not exposed to package consumers.
7
- */
8
- const useExistingAccountsSheet = () => {
9
- const [loading, setLoading] = useState(false);
10
- const [selectedAccount, setSelectedAccount] = useState(null);
11
- const linkPrimaryAccount = useCallback(({ phone, onInitiateLinking }) => {
12
- setLoading(true);
13
- axiosClient({
14
- url: '/auth/mobile/link-primary-account/initiate',
15
- method: 'POST',
16
- data: {
17
- phone,
18
- memberId: selectedAccount?.memberId,
19
- },
20
- })
21
- .then((res) => onInitiateLinking(res.data))
22
- .catch((error) => {
23
- console.log(error);
24
- const message = error?.response?.data?.errors?.[0]?.message ?? 'Unable to initiate linking. Please try again.';
25
- showMessage({ message });
26
- })
27
- .finally(() => setLoading(false));
28
- }, [selectedAccount]);
29
- return {
30
- loading,
31
- linkPrimaryAccount,
32
- selectedAccount,
33
- setSelectedAccount
34
- };
35
- };
36
- export { useExistingAccountsSheet };
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useExistingAccountsSheet } from './hooks/internal/useExistingAccountsSheet';
3
- import { ResponsiveModal, Typography, Flex, Button, Card, Radio } from '@truworth/twc-web-design';
4
- import { SupportDetails } from '../../../../components/SupportDetails';
5
- import { IonIcon } from '../../../../components/IonIcon';
6
- import { LoginMethodCode } from '../../../../enums';
7
- import moment from 'moment';
8
- const ExistingAccountsSheet = ({ visible, hide, phone, existingAccounts, onInitiateAccountLinking }) => {
9
- const { loading, linkPrimaryAccount, selectedAccount, setSelectedAccount, } = useExistingAccountsSheet();
10
- const onContinue = () => {
11
- if (!phone || !selectedAccount?.email) {
12
- return;
13
- }
14
- linkPrimaryAccount({
15
- phone,
16
- onInitiateLinking: ({ sessionToken }) => {
17
- onInitiateAccountLinking?.({
18
- sessionToken,
19
- email: selectedAccount?.email
20
- });
21
- }
22
- });
23
- };
24
- const displayPhone = phone ? `+91${phone.replace(/^.{8}/, 'XXXXXXXX')}` : '+91**********';
25
- return (_jsxs(ResponsiveModal, { open: visible, onClose: hide, onOpenChange: hide, maskClosable: false, title: _jsxs(_Fragment, { children: [_jsx(Typography, { type: "heading", size: "h6", children: "Multiple Accounts Found" }), _jsxs(Typography, { type: "utility", size: "medium", color: "gray-600", className: "mt-2 mb-3", children: ["The phone number ", displayPhone, " is linked to the following accounts."] }), _jsx("hr", {})] }), centered: true, showCloseButton: false, className: "px-0", footer: _jsxs(Flex, { direction: "column", className: 'pt-1', children: [_jsx(Flex, { className: "flex-1 border-t border-gray-300 mb-2" }), selectedAccount &&
26
- _jsxs(Flex, { align: 'center', className: 'bg-utility-warning-bg p-2 rounded-lg gap-1', children: [_jsx(IonIcon, { name: "information-circle-outline", className: "text-utility-warning-main text-2xl" }), _jsxs(Typography, { type: "utility", size: "small", children: [_jsx("span", { className: "text-gray-500 text-[12px]", children: "Once you proceed, this phone number will be removed" }), " from other accounts."] })] }), _jsx(Button, { isFullWidth: true, loading: loading, variant: "primary", label: "Link and Continue", className: 'mt-4 mb-[-16px]', onClick: onContinue, disabled: !selectedAccount }), _jsx(SupportDetails, {})] }), children: [_jsx(Typography, { type: "utility", size: "medium", className: "mb-4", children: "Select account you want to continue with." }), existingAccounts.map((item) => {
27
- return (_jsx(OptionCard, { item: item, onClick: () => setSelectedAccount(item), selectedItem: selectedAccount }, item.memberId));
28
- })] }));
29
- };
30
- const OptionCard = ({ item, onClick, selectedItem }) => {
31
- return (_jsx(Card, { containerStyle: `p-4 mb-2 ${item.memberId === selectedItem?.memberId ? 'border-primary' : 'border-gray-200'}`, children: _jsxs(Flex, { className: 'gap-2', onClick: onClick, children: [_jsx(Radio, { selectedValue: selectedItem?.memberId, options: [{ label: '', value: item.memberId }] }), _jsx(Flex, { direction: 'column', className: 'mt-[-2px]', children: _jsxs(_Fragment, { children: [_jsxs(Flex, { direction: "column", className: "border-b-2 pb-2 w-full", children: [_jsx(Typography, { type: "utility", size: "large", className: "break-words w-full mb-1", children: item.name }), _jsx(Typography, { type: "utility", size: "medium", color: "primary", className: "truncate w-full", children: item.email })] }), _jsxs(_Fragment, { children: [_jsxs(Flex, { justify: "between", className: "mt-3", children: [_jsx(Typography, { type: "utility", size: "medium", color: "gray-700", children: "Registration Source" }), _jsx(Typography, { type: "utility", size: "medium", color: "gray-800", children: item.loginType ? LoginMethodCode[item.loginType] : '—' })] }), _jsxs(Flex, { justify: "between", className: "mt-3", children: [_jsx(Typography, { type: "utility", size: "medium", color: "gray-700", children: "Registration Date" }), _jsx(Typography, { type: "utility", size: "medium", color: "gray-800", children: item.createdOn ? moment(item.createdOn).format('DD/MM/YYYY') : '—' })] })] })] }) })] }) }));
32
- };
33
- export { ExistingAccountsSheet };
@@ -1,73 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect } from 'react';
3
- import { Divider } from '@ui-kitten/components';
4
- import { Platform, Text, TouchableOpacity, View } from 'react-native';
5
- import { useNavigation } from '@react-navigation/native';
6
- import { BottomSheet, Colors, isIphoneX, RadioButton, RoundedButton } from '@truworth/twc-rn-common';
7
- import { useModalize } from 'react-native-modalize';
8
- import { useExistingAccountsSheet } from './hooks/internal/useExistingAccountsSheet';
9
- import { useAuthPackageContext } from '../../../../hooks/internal/useAuthPackageContext';
10
- import { LoginMethodCode } from '../../../../enums';
11
- import moment from 'moment';
12
- import IonIcons from 'react-native-vector-icons/Ionicons';
13
- const { primary, gray, utility } = Colors;
14
- const ExistingAccountsSheet = ({ visible, hide, phone, existingAccounts }) => {
15
- const { ref: sheetRef, open: openSheet, close: closeSheet } = useModalize();
16
- const navigation = useNavigation();
17
- const { openChatSupport } = useAuthPackageContext();
18
- const { loading, linkPrimaryAccount, selectedAccount, setSelectedAccount } = useExistingAccountsSheet();
19
- useEffect(() => {
20
- if (visible) {
21
- openSheet();
22
- }
23
- else {
24
- closeSheet();
25
- }
26
- }, [visible]);
27
- const onContinue = () => {
28
- if (!phone || !selectedAccount?.email) {
29
- return;
30
- }
31
- linkPrimaryAccount({
32
- phone,
33
- onInitiateLinking: ({ sessionToken }) => {
34
- navigation.navigate('VerifyLinkPrimaryAccountEmailOTP', {
35
- phone,
36
- sessionToken,
37
- email: selectedAccount?.email
38
- });
39
- hide();
40
- }
41
- });
42
- };
43
- const displayPhone = phone ? `+91${phone.replace(/^.{8}/, 'XXXXXXXX')}` : '+91**********';
44
- return (_jsx(BottomSheet, { sheetRef: sheetRef, onClose: hide, panGestureEnabled: false, HeaderComponent: _jsxs(_Fragment, { children: [_jsxs(View, { style: { paddingTop: 22, marginHorizontal: 22 }, children: [_jsx(Text, { style: { fontSize: 16, fontWeight: '600', color: gray.gray_900, textAlign: 'center' }, children: "Multiple Accounts Found" }), _jsxs(Text, { style: { fontSize: 12, fontWeight: '500', color: gray.gray_500, lineHeight: 20, textAlign: 'center', marginHorizontal: 16 }, children: ["The phone number ", displayPhone, " is linked to the following accounts."] })] }), _jsx(View, { style: { backgroundColor: gray.gray_200, height: 2, marginVertical: 8 } })] }), flatListProps: {
45
- showsVerticalScrollIndicator: false,
46
- contentContainerStyle: { flexGrow: 1 },
47
- data: existingAccounts,
48
- keyExtractor: (item) => item.memberId,
49
- ListHeaderComponent: _jsx(Text, { style: { fontSize: 14, fontWeight: '600', color: gray.gray_900, marginHorizontal: 16, marginTop: 8 }, children: "Select account you want to continue with." }),
50
- renderItem: ({ item }) => {
51
- return (_jsxs(TouchableOpacity, { activeOpacity: 0.8, style: { padding: 16, margin: 8, borderWidth: 1, borderRadius: 8, borderColor: selectedAccount?.memberId === item.memberId ? primary.primary_main : gray.gray_200 }, onPress: () => setSelectedAccount(item), children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center' }, children: [_jsx(RadioButton, { checked: selectedAccount?.memberId === item.memberId, onChecked: () => setSelectedAccount(item) }), _jsxs(View, { style: { flex: 1, marginStart: 8 }, children: [_jsx(Text, { style: { fontSize: 14, fontWeight: '600', color: gray.gray_900 }, children: item.name }), _jsx(Text, { style: { fontSize: 12, fontWeight: '500', color: primary.primary_main, marginTop: 3 }, children: item.email })] })] }), _jsx(Divider, { style: { marginVertical: 8, backgroundColor: gray.gray_200 } }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }, children: [_jsx(Text, { style: { fontSize: 12, fontWeight: '500', color: gray.gray_500 }, children: "Registration Source" }), _jsx(Text, { style: { fontSize: 12, fontWeight: '600', color: gray.gray_800 }, children: LoginMethodCode[item.loginType] || 'Unknown' })] }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginTop: 8 }, children: [_jsx(Text, { style: { fontSize: 12, fontWeight: '500', color: gray.gray_500 }, children: "Registration Date" }), _jsx(Text, { style: { fontSize: 12, fontWeight: '600', color: gray.gray_800, }, children: moment(item.createdOn).format('DD/MM/YYYY') })] })] }, item.memberId));
52
- }
53
- }, FooterComponent: _jsxs(View, { style: {
54
- width: '100%', backgroundColor: 'white', marginTop: 8,
55
- padding: 16, marginBottom: isIphoneX() ? 30 : 0,
56
- borderTopWidth: Platform.OS == 'android' ? 1 : 0, borderTopColor: gray.gray_300,
57
- shadowColor: '#DDDDDD', shadowOffset: { width: 0, height: -2 },
58
- shadowOpacity: 1, shadowRadius: 3, elevation: 3
59
- }, children: [selectedAccount &&
60
- _jsxs(View, { style: {
61
- backgroundColor: utility.warning_bg,
62
- padding: 8,
63
- borderRadius: 8,
64
- marginBottom: 8,
65
- flexDirection: 'row',
66
- alignItems: 'center',
67
- }, children: [_jsx(IonIcons, { size: 16, name: "information-circle", style: { marginRight: 8 }, color: utility.warning_main }), _jsxs(Text, { style: {
68
- flex: 1, fontSize: 12, fontWeight: '500',
69
- lineHeight: 18, color: gray.gray_500,
70
- }, children: ["Once you proceed, this phone number will be ", _jsx(Text, { style: { fontWeight: '600', color: gray.gray_900 }, children: "removed from other accounts." })] })] }), _jsx(RoundedButton, { label: 'Link and Continue', size: 'large', loading: loading, disabled: !selectedAccount, onPress: onContinue, containerStyle: { marginBottom: 8 } }), openChatSupport &&
71
- _jsxs(TouchableOpacity, { activeOpacity: 0.8, onPress: openChatSupport, style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', padding: 8 }, children: [_jsx(IonIcons, { size: 12, name: 'headset', color: primary.primary_main }), _jsx(Text, { style: { fontSize: 14, fontWeight: '600', color: primary.primary_main, marginStart: 8 }, children: "Connect with Support" })] })] }) }));
72
- };
73
- export { ExistingAccountsSheet };
@@ -1,67 +0,0 @@
1
- import { useState } from "react";
2
- import { checkMobileExists } from "../../../../api/auth";
3
- import { showMessage } from "../../../../helpers/show-message";
4
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
5
- import { RegistrationMethod } from "../../../../enums";
6
- const useEnterMobile = () => {
7
- const [loading, setLoading] = useState(false);
8
- const [isValidPhone, setValidPhone] = useState(false);
9
- const [showExistingAccountsSheet, setShowExistingAccountsSheet] = useState(false);
10
- const [phone, setPhone] = useState('');
11
- const [countryCode, setCountryCode] = useState('91');
12
- const [existingAccounts, setExistingAccounts] = useState([]);
13
- const { onRegistrationMethodChange } = useAuthPackageContext();
14
- const handleEnterMobile = (text) => {
15
- setPhone(text);
16
- const isNumeric = /^[0-9]+$/.test(text);
17
- if (countryCode === '91' && text.length === 10 && isNumeric) {
18
- setValidPhone(true);
19
- }
20
- else if (countryCode !== '91' && text.length >= 6 && text.length <= 15 && isNumeric) {
21
- setValidPhone(true);
22
- }
23
- else {
24
- setValidPhone(false);
25
- }
26
- };
27
- const handleValidatePhone = async ({ onValidate }) => {
28
- setLoading(true);
29
- try {
30
- const { mobileExist, linkedAccounts } = await checkMobileExists(phone);
31
- if (mobileExist) {
32
- if (linkedAccounts && linkedAccounts.length > 1) {
33
- setExistingAccounts(linkedAccounts);
34
- return setShowExistingAccountsSheet(true);
35
- }
36
- }
37
- if (!mobileExist) {
38
- onRegistrationMethodChange(RegistrationMethod.MOBILE);
39
- }
40
- onValidate({ mobileExist, email: linkedAccounts?.[0]?.email ?? '' });
41
- }
42
- catch (err) {
43
- const errorMessage = err?.response?.data?.errors?.[0]?.message ?? 'Something went wrong';
44
- showMessage({ message: errorMessage });
45
- }
46
- finally {
47
- setLoading(false);
48
- }
49
- };
50
- const handleClearPhoneInput = () => {
51
- setPhone('');
52
- setValidPhone(false);
53
- };
54
- return {
55
- loading,
56
- phone,
57
- isValidPhone,
58
- countryCode, setCountryCode,
59
- existingAccounts,
60
- showExistingAccountsSheet,
61
- setShowExistingAccountsSheet,
62
- handleValidatePhone,
63
- handleEnterMobile,
64
- handleClearPhoneInput,
65
- };
66
- };
67
- export { useEnterMobile };