@truworth/twc-auth 3.0.7 → 3.0.9

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 (381) hide show
  1. package/build/assets/animation/redirect-home.json +1101 -0
  2. package/build/assets/cross_icon copy.svg +5 -0
  3. package/build/assets/cross_icon.svg +5 -0
  4. package/build/assets/email_icon.svg +6 -0
  5. package/build/assets/gender-diversity.svg +22 -0
  6. package/build/assets/loading-spinner.json +1 -0
  7. package/build/assets/logo.svg +55 -0
  8. package/build/assets/okay_icon.svg +3 -0
  9. package/build/src/api/auth.js +36 -0
  10. package/build/src/api/axiosClient/index.js +5 -0
  11. package/build/src/api/axiosClient/index.native.js +5 -0
  12. package/build/src/components/AdvancedTransitionWrapper/index.js +374 -0
  13. package/build/src/components/AdvancedTransitionWrapper/index.native.js +10 -0
  14. package/build/src/components/AdvancedTransitionWrapper/types.js +1 -0
  15. package/build/src/components/ConfirmationModal/index.js +11 -0
  16. package/build/src/components/ConfirmationModal/index.native.js +15 -0
  17. package/build/src/components/ConfirmationModal/types.js +1 -0
  18. package/build/src/components/IonIcon/index.js +11 -0
  19. package/build/src/components/IonIcon/index.native.js +9 -0
  20. package/build/src/components/IonIcon/types.js +1 -0
  21. package/build/src/components/LoadingAnimation/index.js +50 -0
  22. package/build/src/components/OTPStatusLabel/index.js +10 -0
  23. package/build/src/components/OTPStatusLabel/index.native.js +21 -0
  24. package/build/src/components/OTPStatusLabel/types.js +1 -0
  25. package/build/src/components/PasswordCriteria/hooks/usePasswordCriteria.js +71 -0
  26. package/build/src/components/PasswordCriteria/index.js +47 -0
  27. package/build/src/components/PasswordCriteria/index.native.js +22 -0
  28. package/build/src/components/PasswordCriteria/types.js +1 -0
  29. package/build/src/components/ScreenLayout/index.js +12 -0
  30. package/build/src/components/ScreenLayout/index.native.js +18 -0
  31. package/build/src/components/ScreenLayout/types.js +1 -0
  32. package/build/src/components/SupportDetails/index.js +9 -0
  33. package/build/src/components/SupportDetails/index.native.js +6 -0
  34. package/build/src/components/VerifyEmailOTP/index.js +20 -0
  35. package/build/src/components/VerifyEmailOTP/index.native.js +22 -0
  36. package/build/src/components/VerifyEmailOTP/types.js +1 -0
  37. package/build/src/components/VerifyMobileOTP/index.js +25 -0
  38. package/build/src/components/VerifyMobileOTP/index.native.js +38 -0
  39. package/build/src/components/VerifyMobileOTP/types.js +1 -0
  40. package/build/src/constants/base-url/index.js +5 -0
  41. package/build/src/constants/base-url/index.native.js +1 -0
  42. package/build/src/constants/cdn-url/index.js +2 -0
  43. package/build/src/constants/cdn-url/index.native.js +5 -0
  44. package/build/src/constants/defaultPolicy.js +9 -0
  45. package/build/src/constants/password-requirements.js +7 -0
  46. package/build/src/constants/social-login-options.js +16 -0
  47. package/build/src/contexts/AuthContext.js +192 -0
  48. package/build/src/contexts/type.js +1 -0
  49. package/build/src/enums/index.js +3 -0
  50. package/build/src/enums/loginMethod.enum.js +8 -0
  51. package/build/src/enums/registrationMethod.enum.js +7 -0
  52. package/build/src/enums/socialLogins.enum.js +6 -0
  53. package/build/src/helpers/network.js +93 -0
  54. package/build/src/helpers/show-message/index.js +19 -0
  55. package/build/src/helpers/show-message/index.native.js +14 -0
  56. package/build/src/helpers/show-message/types.js +1 -0
  57. package/build/src/helpers/types.js +1 -0
  58. package/build/src/helpers/validation.js +12 -0
  59. package/build/src/hooks/internal/useAuthPackageContext.js +9 -0
  60. package/build/src/hooks/internal/useTimer.js +40 -0
  61. package/build/src/hooks/useAuthContext.js +10 -0
  62. package/build/src/hooks/useNavigator.js +83 -0
  63. package/build/src/hooks/useRequest.js +34 -0
  64. package/build/src/index.js +23 -0
  65. package/build/src/navigator/index.js +10 -0
  66. package/build/src/navigator/index.native.js +27 -0
  67. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.js +37 -0
  68. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.native.js +6 -0
  69. package/build/src/screens/CountryCode/components/CountryCodeDropdown/types.js +1 -0
  70. package/build/src/screens/CountryCode/hooks/internal/useCountryCode.js +38 -0
  71. package/build/src/screens/CountryCode/index.js +10 -0
  72. package/build/src/screens/CountryCode/index.native.js +37 -0
  73. package/build/src/screens/CountryCode/type.js +1 -0
  74. package/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +46 -0
  75. package/build/src/screens/CreatePassword/index.js +19 -0
  76. package/build/src/screens/CreatePassword/index.native.js +32 -0
  77. package/build/src/screens/CreatePassword/type.js +1 -0
  78. package/build/src/screens/EnterEmail/hooks/internal/useEnterEmail.js +77 -0
  79. package/build/src/screens/EnterEmail/index.js +58 -0
  80. package/build/src/screens/EnterEmail/index.native.js +31 -0
  81. package/build/src/screens/EnterEmail/types.js +1 -0
  82. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.js +36 -0
  83. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.js +33 -0
  84. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.native.js +73 -0
  85. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/types.js +1 -0
  86. package/build/src/screens/EnterMobile/hooks/internal/useEnterMobile.js +70 -0
  87. package/build/src/screens/EnterMobile/index.js +82 -0
  88. package/build/src/screens/EnterMobile/index.native.js +56 -0
  89. package/build/src/screens/EnterMobile/types.js +1 -0
  90. package/build/src/screens/EnterPassword/hooks/internal/useEnterPassword.js +79 -0
  91. package/build/src/screens/EnterPassword/index.js +68 -0
  92. package/build/src/screens/EnterPassword/index.native.js +41 -0
  93. package/build/src/screens/EnterPassword/types.js +1 -0
  94. package/build/src/screens/Login/components/LoginWebComponent/index.js +63 -0
  95. package/build/src/screens/Login/components/LoginWebComponent/index.native.js +6 -0
  96. package/build/src/screens/Login/index.js +10 -0
  97. package/build/src/screens/Login/index.native.js +6 -0
  98. package/build/src/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.js +85 -0
  99. package/build/src/screens/LoginWithEmailOTP/index.js +8 -0
  100. package/build/src/screens/LoginWithEmailOTP/index.native.js +10 -0
  101. package/build/src/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.js +72 -0
  102. package/build/src/screens/LoginWithMobileOTP/index.js +8 -0
  103. package/build/src/screens/LoginWithMobileOTP/index.native.js +10 -0
  104. package/build/src/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.js +71 -0
  105. package/build/src/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.native.js +6 -0
  106. package/build/src/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.js +52 -0
  107. package/build/src/screens/PartnerSSO/PartnerLogin/index.js +2 -0
  108. package/build/src/screens/PartnerSSO/PartnerLogin/types.js +1 -0
  109. package/build/src/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.js +207 -0
  110. package/build/src/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.native.js +6 -0
  111. package/build/src/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.js +90 -0
  112. package/build/src/screens/PartnerSSO/PartnerRegistration/index.js +2 -0
  113. package/build/src/screens/PartnerSSO/PartnerRegistration/types.js +1 -0
  114. package/build/src/screens/PartnerSSO/index.js +2 -0
  115. package/build/src/screens/Profile/components/EditMobileNumber/index.js +31 -0
  116. package/build/src/screens/Profile/components/EditMobileNumber/index.native.js +8 -0
  117. package/build/src/screens/Profile/components/EditPassword/index.js +29 -0
  118. package/build/src/screens/Profile/components/EditPassword/index.native.js +8 -0
  119. package/build/src/screens/Profile/components/EditProfile/index.js +89 -0
  120. package/build/src/screens/Profile/components/EditProfile/index.native.js +8 -0
  121. package/build/src/screens/Profile/components/OtpVerificationModal/index.js +61 -0
  122. package/build/src/screens/Profile/components/OtpVerificationModal/index.native.js +7 -0
  123. package/build/src/screens/Profile/components/ProfileWebComponent/index.js +80 -0
  124. package/build/src/screens/Profile/components/ProfileWebComponent/index.native.js +9 -0
  125. package/build/src/screens/Profile/hooks/internal/useProfile.js +185 -0
  126. package/build/src/screens/Profile/index.js +6 -0
  127. package/build/src/screens/Profile/index.native.js +6 -0
  128. package/build/src/screens/Profile/types.js +1 -0
  129. package/build/src/screens/ResetPassword/hooks/internal/useResetPassword.js +57 -0
  130. package/build/src/screens/ResetPassword/index.js +46 -0
  131. package/build/src/screens/ResetPassword/index.native.js +26 -0
  132. package/build/src/screens/ResetPassword/types.js +1 -0
  133. package/build/src/screens/SSOLogin/AuthWebView/index.js +9 -0
  134. package/build/src/screens/SSOLogin/AuthWebView/index.native.js +42 -0
  135. package/build/src/screens/SSOLogin/AuthWebView/types.js +1 -0
  136. package/build/src/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.js +39 -0
  137. package/build/src/screens/SSOLogin/AuthenticationMethods/index.js +50 -0
  138. package/build/src/screens/SSOLogin/AuthenticationMethods/index.native.js +59 -0
  139. package/build/src/screens/SSOLogin/AuthenticationMethods/types.js +1 -0
  140. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.js +62 -0
  141. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.js +6 -0
  142. package/build/src/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.js +58 -0
  143. package/build/src/screens/SSOLogin/SSOCallback/index.js +9 -0
  144. package/build/src/screens/SSOLogin/SSOCallback/index.native.js +35 -0
  145. package/build/src/screens/SSOLogin/SSOCallback/types.js +1 -0
  146. package/build/src/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.js +71 -0
  147. package/build/src/screens/SSOLogin/SearchOrganization/index.js +46 -0
  148. package/build/src/screens/SSOLogin/SearchOrganization/index.native.js +37 -0
  149. package/build/src/screens/SSOLogin/SearchOrganization/types.js +1 -0
  150. package/build/src/screens/SignUp/components/SignUpForm/index.js +215 -0
  151. package/build/src/screens/SignUp/components/SignUpForm/index.native.js +6 -0
  152. package/build/src/screens/SignUp/components/SignUpForm/type.js +1 -0
  153. package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +62 -0
  154. package/build/src/screens/SignUp/components/SignUpWebComponent/index.native.js +6 -0
  155. package/build/src/screens/SignUp/components/SignUpWebComponent/types.js +1 -0
  156. package/build/src/screens/SignUp/hooks/internal/useSignUp.js +134 -0
  157. package/build/src/screens/SignUp/index.js +6 -0
  158. package/build/src/screens/SignUp/index.native.js +188 -0
  159. package/build/src/screens/SignUp/types.js +1 -0
  160. package/build/src/screens/UserConsent/hooks/internal/useConsent.js +64 -0
  161. package/build/src/screens/UserConsent/index.js +84 -0
  162. package/build/src/screens/UserConsent/index.native.js +47 -0
  163. package/build/src/screens/UserConsent/types.js +1 -0
  164. package/build/src/screens/VerifyEmail/hooks/internal/useVerifyEmail.js +69 -0
  165. package/build/src/screens/VerifyEmail/index.js +8 -0
  166. package/build/src/screens/VerifyEmail/index.native.js +14 -0
  167. package/build/src/screens/VerifyEmail/types.js +1 -0
  168. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.js +73 -0
  169. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.js +8 -0
  170. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.js +14 -0
  171. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/types.js +1 -0
  172. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.js +83 -0
  173. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.js +8 -0
  174. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.js +10 -0
  175. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/types.js +1 -0
  176. package/build/src/screens/VerifyMobile/hooks/internal/useVerifyMobile.js +74 -0
  177. package/build/src/screens/VerifyMobile/index.js +8 -0
  178. package/build/src/screens/VerifyMobile/index.native.js +9 -0
  179. package/build/src/screens/VerifyMobile/types.js +1 -0
  180. package/build/src/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.js +74 -0
  181. package/build/src/screens/VerifyResetPasswordOTP/index.js +8 -0
  182. package/build/src/screens/VerifyResetPasswordOTP/index.native.js +14 -0
  183. package/build/src/screens/Welcome/SocialAuth/commonSocialAuth.js +127 -0
  184. package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.js +187 -0
  185. package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.js +13 -0
  186. package/build/src/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.js +115 -0
  187. package/build/src/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.js +72 -0
  188. package/build/src/screens/Welcome/components/SocialLoginModal/index.js +9 -0
  189. package/build/src/screens/Welcome/components/SocialLoginModal/index.native.js +21 -0
  190. package/build/src/screens/Welcome/components/SocialLoginModal/types.js +1 -0
  191. package/build/src/screens/Welcome/hooks/internal/useWelcome.js +26 -0
  192. package/build/src/screens/Welcome/index.js +28 -0
  193. package/build/src/screens/Welcome/index.native.js +78 -0
  194. package/build/src/types/types.js +2 -0
  195. package/build/types/api/auth.d.ts +11 -0
  196. package/build/types/api/axiosClient/index.d.ts +1 -0
  197. package/build/types/api/axiosClient/index.native.d.ts +1 -0
  198. package/build/types/components/AdvancedTransitionWrapper/index.d.ts +3 -0
  199. package/build/types/components/AdvancedTransitionWrapper/index.native.d.ts +5 -0
  200. package/build/types/components/AdvancedTransitionWrapper/types.d.ts +25 -0
  201. package/build/types/components/ConfirmationModal/index.d.ts +3 -0
  202. package/build/types/components/ConfirmationModal/index.native.d.ts +3 -0
  203. package/build/types/components/ConfirmationModal/types.d.ts +16 -0
  204. package/build/types/components/IonIcon/index.d.ts +3 -0
  205. package/build/types/components/IonIcon/index.native.d.ts +4 -0
  206. package/build/types/components/IonIcon/types.d.ts +6 -0
  207. package/build/types/components/LoadingAnimation/index.d.ts +6 -0
  208. package/build/types/components/OTPStatusLabel/index.d.ts +2 -0
  209. package/build/types/components/OTPStatusLabel/index.native.d.ts +3 -0
  210. package/build/types/components/OTPStatusLabel/types.d.ts +6 -0
  211. package/build/types/components/PasswordCriteria/hooks/usePasswordCriteria.d.ts +8 -0
  212. package/build/types/components/PasswordCriteria/index.d.ts +3 -0
  213. package/build/types/components/PasswordCriteria/index.native.d.ts +3 -0
  214. package/build/types/components/PasswordCriteria/types.d.ts +15 -0
  215. package/build/types/components/ScreenLayout/index.d.ts +3 -0
  216. package/build/types/components/ScreenLayout/index.native.d.ts +3 -0
  217. package/build/types/components/ScreenLayout/types.d.ts +13 -0
  218. package/build/types/components/SupportDetails/index.d.ts +2 -0
  219. package/build/types/components/SupportDetails/index.native.d.ts +2 -0
  220. package/build/types/components/VerifyEmailOTP/index.d.ts +3 -0
  221. package/build/types/components/VerifyEmailOTP/index.native.d.ts +3 -0
  222. package/build/types/components/VerifyEmailOTP/types.d.ts +9 -0
  223. package/build/types/components/VerifyMobileOTP/index.d.ts +3 -0
  224. package/build/types/components/VerifyMobileOTP/index.native.d.ts +3 -0
  225. package/build/types/components/VerifyMobileOTP/types.d.ts +9 -0
  226. package/build/types/constants/base-url/index.d.ts +1 -0
  227. package/build/types/constants/base-url/index.native.d.ts +1 -0
  228. package/build/types/constants/cdn-url/index.d.ts +2 -0
  229. package/build/types/constants/cdn-url/index.native.d.ts +3 -0
  230. package/build/types/constants/defaultPolicy.d.ts +9 -0
  231. package/build/types/constants/password-requirements.d.ts +4 -0
  232. package/build/types/constants/social-login-options.d.ts +3 -0
  233. package/build/types/contexts/AuthContext.d.ts +40 -0
  234. package/build/types/contexts/type.d.ts +94 -0
  235. package/build/types/enums/index.d.ts +3 -0
  236. package/build/types/enums/loginMethod.enum.d.ts +7 -0
  237. package/build/types/enums/registrationMethod.enum.d.ts +6 -0
  238. package/build/types/enums/socialLogins.enum.d.ts +5 -0
  239. package/build/types/helpers/network.d.ts +5 -0
  240. package/build/types/helpers/show-message/index.d.ts +3 -0
  241. package/build/types/helpers/show-message/index.native.d.ts +3 -0
  242. package/build/types/helpers/show-message/types.d.ts +6 -0
  243. package/build/types/helpers/types.d.ts +19 -0
  244. package/build/types/helpers/validation.d.ts +2 -0
  245. package/build/types/hooks/internal/useAuthPackageContext.d.ts +1 -0
  246. package/build/types/hooks/internal/useTimer.d.ts +3 -0
  247. package/build/types/hooks/useAuthContext.d.ts +2 -0
  248. package/build/types/hooks/useNavigator.d.ts +66 -0
  249. package/build/types/hooks/useRequest.d.ts +5 -0
  250. package/build/types/index.d.ts +15 -0
  251. package/build/types/navigator/index.d.ts +2 -0
  252. package/build/types/navigator/index.native.d.ts +82 -0
  253. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.d.ts +3 -0
  254. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.native.d.ts +2 -0
  255. package/build/types/screens/CountryCode/components/CountryCodeDropdown/types.d.ts +17 -0
  256. package/build/types/screens/CountryCode/hooks/internal/useCountryCode.d.ts +12 -0
  257. package/build/types/screens/CountryCode/index.d.ts +2 -0
  258. package/build/types/screens/CountryCode/index.native.d.ts +2 -0
  259. package/build/types/screens/CountryCode/type.d.ts +11 -0
  260. package/build/types/screens/CreatePassword/hooks/internal/useCreatePassword.d.ts +37 -0
  261. package/build/types/screens/CreatePassword/index.d.ts +3 -0
  262. package/build/types/screens/CreatePassword/index.native.d.ts +4 -0
  263. package/build/types/screens/CreatePassword/type.d.ts +43 -0
  264. package/build/types/screens/EnterEmail/hooks/internal/useEnterEmail.d.ts +19 -0
  265. package/build/types/screens/EnterEmail/index.d.ts +3 -0
  266. package/build/types/screens/EnterEmail/index.native.d.ts +4 -0
  267. package/build/types/screens/EnterEmail/types.d.ts +13 -0
  268. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.d.ts +13 -0
  269. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.d.ts +3 -0
  270. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.native.d.ts +3 -0
  271. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/types.d.ts +28 -0
  272. package/build/types/screens/EnterMobile/hooks/internal/useEnterMobile.d.ts +15 -0
  273. package/build/types/screens/EnterMobile/index.d.ts +4 -0
  274. package/build/types/screens/EnterMobile/index.native.d.ts +4 -0
  275. package/build/types/screens/EnterMobile/types.d.ts +44 -0
  276. package/build/types/screens/EnterPassword/hooks/internal/useEnterPassword.d.ts +25 -0
  277. package/build/types/screens/EnterPassword/index.d.ts +3 -0
  278. package/build/types/screens/EnterPassword/index.native.d.ts +4 -0
  279. package/build/types/screens/EnterPassword/types.d.ts +24 -0
  280. package/build/types/screens/Login/components/LoginWebComponent/index.d.ts +2 -0
  281. package/build/types/screens/Login/components/LoginWebComponent/index.native.d.ts +2 -0
  282. package/build/types/screens/Login/index.d.ts +2 -0
  283. package/build/types/screens/Login/index.native.d.ts +2 -0
  284. package/build/types/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.d.ts +17 -0
  285. package/build/types/screens/LoginWithEmailOTP/index.d.ts +7 -0
  286. package/build/types/screens/LoginWithEmailOTP/index.native.d.ts +4 -0
  287. package/build/types/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.d.ts +11 -0
  288. package/build/types/screens/LoginWithMobileOTP/index.d.ts +5 -0
  289. package/build/types/screens/LoginWithMobileOTP/index.native.d.ts +4 -0
  290. package/build/types/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.d.ts +25 -0
  291. package/build/types/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.native.d.ts +2 -0
  292. package/build/types/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.d.ts +8 -0
  293. package/build/types/screens/PartnerSSO/PartnerLogin/index.d.ts +2 -0
  294. package/build/types/screens/PartnerSSO/PartnerLogin/types.d.ts +35 -0
  295. package/build/types/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.d.ts +24 -0
  296. package/build/types/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.native.d.ts +2 -0
  297. package/build/types/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.d.ts +8 -0
  298. package/build/types/screens/PartnerSSO/PartnerRegistration/index.d.ts +2 -0
  299. package/build/types/screens/PartnerSSO/PartnerRegistration/types.d.ts +63 -0
  300. package/build/types/screens/PartnerSSO/index.d.ts +2 -0
  301. package/build/types/screens/Profile/components/EditMobileNumber/index.d.ts +6 -0
  302. package/build/types/screens/Profile/components/EditMobileNumber/index.native.d.ts +3 -0
  303. package/build/types/screens/Profile/components/EditPassword/index.d.ts +6 -0
  304. package/build/types/screens/Profile/components/EditPassword/index.native.d.ts +3 -0
  305. package/build/types/screens/Profile/components/EditProfile/index.d.ts +6 -0
  306. package/build/types/screens/Profile/components/EditProfile/index.native.d.ts +3 -0
  307. package/build/types/screens/Profile/components/OtpVerificationModal/index.d.ts +4 -0
  308. package/build/types/screens/Profile/components/OtpVerificationModal/index.native.d.ts +3 -0
  309. package/build/types/screens/Profile/components/ProfileWebComponent/index.d.ts +4 -0
  310. package/build/types/screens/Profile/components/ProfileWebComponent/index.native.d.ts +3 -0
  311. package/build/types/screens/Profile/hooks/internal/useProfile.d.ts +26 -0
  312. package/build/types/screens/Profile/index.d.ts +7 -0
  313. package/build/types/screens/Profile/index.native.d.ts +7 -0
  314. package/build/types/screens/Profile/types.d.ts +53 -0
  315. package/build/types/screens/ResetPassword/hooks/internal/useResetPassword.d.ts +29 -0
  316. package/build/types/screens/ResetPassword/index.d.ts +3 -0
  317. package/build/types/screens/ResetPassword/index.native.d.ts +4 -0
  318. package/build/types/screens/ResetPassword/types.d.ts +11 -0
  319. package/build/types/screens/SSOLogin/AuthWebView/index.d.ts +2 -0
  320. package/build/types/screens/SSOLogin/AuthWebView/index.native.d.ts +4 -0
  321. package/build/types/screens/SSOLogin/AuthWebView/types.d.ts +8 -0
  322. package/build/types/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.d.ts +9 -0
  323. package/build/types/screens/SSOLogin/AuthenticationMethods/index.d.ts +3 -0
  324. package/build/types/screens/SSOLogin/AuthenticationMethods/index.native.d.ts +4 -0
  325. package/build/types/screens/SSOLogin/AuthenticationMethods/types.d.ts +14 -0
  326. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.d.ts +6 -0
  327. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.d.ts +2 -0
  328. package/build/types/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.d.ts +15 -0
  329. package/build/types/screens/SSOLogin/SSOCallback/index.d.ts +2 -0
  330. package/build/types/screens/SSOLogin/SSOCallback/index.native.d.ts +4 -0
  331. package/build/types/screens/SSOLogin/SSOCallback/types.d.ts +14 -0
  332. package/build/types/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.d.ts +18 -0
  333. package/build/types/screens/SSOLogin/SearchOrganization/index.d.ts +3 -0
  334. package/build/types/screens/SSOLogin/SearchOrganization/index.native.d.ts +4 -0
  335. package/build/types/screens/SSOLogin/SearchOrganization/types.d.ts +13 -0
  336. package/build/types/screens/SignUp/components/SignUpForm/index.d.ts +3 -0
  337. package/build/types/screens/SignUp/components/SignUpForm/index.native.d.ts +2 -0
  338. package/build/types/screens/SignUp/components/SignUpForm/type.d.ts +6 -0
  339. package/build/types/screens/SignUp/components/SignUpWebComponent/index.d.ts +2 -0
  340. package/build/types/screens/SignUp/components/SignUpWebComponent/index.native.d.ts +2 -0
  341. package/build/types/screens/SignUp/components/SignUpWebComponent/types.d.ts +9 -0
  342. package/build/types/screens/SignUp/hooks/internal/useSignUp.d.ts +48 -0
  343. package/build/types/screens/SignUp/index.d.ts +2 -0
  344. package/build/types/screens/SignUp/index.native.d.ts +4 -0
  345. package/build/types/screens/SignUp/types.d.ts +40 -0
  346. package/build/types/screens/UserConsent/hooks/internal/useConsent.d.ts +10 -0
  347. package/build/types/screens/UserConsent/index.d.ts +3 -0
  348. package/build/types/screens/UserConsent/index.native.d.ts +4 -0
  349. package/build/types/screens/UserConsent/types.d.ts +33 -0
  350. package/build/types/screens/VerifyEmail/hooks/internal/useVerifyEmail.d.ts +19 -0
  351. package/build/types/screens/VerifyEmail/index.d.ts +3 -0
  352. package/build/types/screens/VerifyEmail/index.native.d.ts +4 -0
  353. package/build/types/screens/VerifyEmail/types.d.ts +8 -0
  354. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.d.ts +15 -0
  355. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.d.ts +3 -0
  356. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.d.ts +4 -0
  357. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/types.d.ts +14 -0
  358. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.d.ts +17 -0
  359. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.d.ts +3 -0
  360. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.d.ts +4 -0
  361. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/types.d.ts +5 -0
  362. package/build/types/screens/VerifyMobile/hooks/internal/useVerifyMobile.d.ts +14 -0
  363. package/build/types/screens/VerifyMobile/index.d.ts +3 -0
  364. package/build/types/screens/VerifyMobile/index.native.d.ts +4 -0
  365. package/build/types/screens/VerifyMobile/types.d.ts +5 -0
  366. package/build/types/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.d.ts +19 -0
  367. package/build/types/screens/VerifyResetPasswordOTP/index.d.ts +7 -0
  368. package/build/types/screens/VerifyResetPasswordOTP/index.native.d.ts +4 -0
  369. package/build/types/screens/Welcome/SocialAuth/commonSocialAuth.d.ts +50 -0
  370. package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.d.ts +7 -0
  371. package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.d.ts +7 -0
  372. package/build/types/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.d.ts +5 -0
  373. package/build/types/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.d.ts +4 -0
  374. package/build/types/screens/Welcome/components/SocialLoginModal/index.d.ts +3 -0
  375. package/build/types/screens/Welcome/components/SocialLoginModal/index.native.d.ts +3 -0
  376. package/build/types/screens/Welcome/components/SocialLoginModal/types.d.ts +8 -0
  377. package/build/types/screens/Welcome/hooks/internal/useWelcome.d.ts +22 -0
  378. package/build/types/screens/Welcome/index.d.ts +4 -0
  379. package/build/types/screens/Welcome/index.native.d.ts +4 -0
  380. package/build/types/types/types.d.ts +115 -0
  381. package/package.json +3 -1
@@ -0,0 +1,215 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import React, { useEffect, useState } from "react";
3
+ import { CDN_IMAGES_URL } from "../../../../constants/cdn-url";
4
+ import { Button, Col, CustomCheckbox, DatePicker, Flex, Form, RadioGroup, ResponsiveModal, Row, TextInput, Typography, useForm, validationPatterns } from "@truworth/twc-web-design";
5
+ import { CalendarDays } from "lucide-react";
6
+ import { SupportDetails } from "../../../../components/SupportDetails";
7
+ import { ScreenLayout } from "../../../../components/ScreenLayout";
8
+ import { CountryCodeDropdown } from "../../../CountryCode/components/CountryCodeDropdown";
9
+ import { useSignUp } from "../../hooks/internal/useSignUp";
10
+ import { useNavigator } from "../../../../hooks/useNavigator";
11
+ import ReCAPTCHA from 'react-google-recaptcha';
12
+ import moment from "moment";
13
+ import dayjs from 'dayjs';
14
+ import { RegistrationMethod } from "../../../../enums";
15
+ import { showMessage } from "../../../../helpers/show-message";
16
+ const getQueryParam = (param) => {
17
+ if (Array.isArray(param))
18
+ return param[0];
19
+ return param;
20
+ };
21
+ const isProduction = process.env.NODE_ENV === 'production';
22
+ const SignUpFormComponent = ({ userDetails, onContinue }) => {
23
+ const [isHuman, setIsHuman] = useState(isProduction ? false : true);
24
+ const [termsAndConditions, setTermsAndConditions] = useState(false);
25
+ const [selectedCountry, setSelectedCountry] = useState({ countryCode: "in", phoneCode: "91", name: "INDIA" });
26
+ const navigator = useNavigator();
27
+ const routerQuery = navigator.query;
28
+ const form = useForm({
29
+ liveValidation: true,
30
+ defaultValues: {
31
+ firstName: userDetails.firstName ?? getQueryParam(routerQuery.firstName),
32
+ lastName: userDetails.lastName ?? getQueryParam(routerQuery.lastName),
33
+ dateOfBirth: userDetails.selectedDOB,
34
+ email: userDetails.email ?? "",
35
+ phone: userDetails.phone ?? "",
36
+ gender: userDetails.gender ?? "",
37
+ referralCode: userDetails.referralCode ?? "",
38
+ }
39
+ });
40
+ const values = form.watch();
41
+ useEffect(() => {
42
+ const rawMethod = routerQuery.registrationMethod;
43
+ const registrationMethodFromQuery = Array.isArray(rawMethod) ? rawMethod[0] : rawMethod;
44
+ if (typeof registrationMethodFromQuery === 'string') {
45
+ const method = registrationMethodFromQuery.toLowerCase();
46
+ // Validate that method is a valid RegistrationMethod value
47
+ const validMethods = Object.values(RegistrationMethod);
48
+ if (!validMethods.includes(method)) {
49
+ showMessage({ message: `Invalid registration method: ${method}` });
50
+ return;
51
+ }
52
+ onRegistrationMethodChange(method);
53
+ }
54
+ }, [routerQuery.registrationMethod]);
55
+ const { loading, setGender, setSelectedDOB, phone, setPhone, email, setEmail, setReferralCode, setCountryCode, countryCode, linkedAccounts, registrationMethod, onRegistrationMethodChange, linkedAccountsSheet, showLinkedAccountsSheet, handleFirstNameChange, handleLastNameChange, handleEmailChange, handleMobileChange, handleSubmit, getLoginTypeText, appName, termsAndConditionsUrl } = useSignUp();
56
+ useEffect(() => {
57
+ if (!registrationMethod) {
58
+ const registrationMethodFromQuery = routerQuery.registrationMethod;
59
+ if (typeof registrationMethodFromQuery === 'string') {
60
+ const method = registrationMethodFromQuery.toLowerCase();
61
+ onRegistrationMethodChange(method);
62
+ }
63
+ }
64
+ ;
65
+ }, [registrationMethod]);
66
+ useEffect(() => {
67
+ if (routerQuery.registrationToken) {
68
+ form.reset({
69
+ firstName: getQueryParam(routerQuery.firstName) ?? userDetails.firstName,
70
+ lastName: getQueryParam(routerQuery.lastName) ?? userDetails.lastName,
71
+ });
72
+ }
73
+ }, []);
74
+ useEffect(() => {
75
+ if (values.phone || values.email) {
76
+ if (registrationMethod === RegistrationMethod.MOBILE) {
77
+ setEmail(values.email);
78
+ }
79
+ else {
80
+ setPhone(values.phone);
81
+ }
82
+ }
83
+ }, [values.phone, values.email, registrationMethod]);
84
+ const disabledDate = (current) => {
85
+ const currentDate = dayjs(current);
86
+ if (!currentDate.isValid()) {
87
+ return false;
88
+ }
89
+ const thirteenYearsAgo = dayjs().subtract(13, 'years');
90
+ const oldestAllowedDate = dayjs('1900-01-01');
91
+ return currentDate.isAfter(thirteenYearsAgo) || currentDate.isBefore(oldestAllowedDate);
92
+ };
93
+ const handleCaptcha = (value) => {
94
+ setIsHuman(Boolean(value));
95
+ };
96
+ const onGoToLogin = () => {
97
+ navigator.pushAbsolute('/login');
98
+ };
99
+ const onProceed = () => {
100
+ const params = {
101
+ firstName: values.firstName,
102
+ lastName: values.lastName,
103
+ gender: values.gender,
104
+ selectedDOB: values.dateOfBirth,
105
+ referralCode: values.referralCode,
106
+ email: email.length > 0 ? email : getQueryParam(routerQuery.email) || '',
107
+ phone: phone.length > 0 ? phone : getQueryParam(routerQuery.phone) || '',
108
+ countryCode,
109
+ };
110
+ onContinue(params);
111
+ };
112
+ const isMobileRegistration = registrationMethod === RegistrationMethod.MOBILE;
113
+ const isDisabled = !values.firstName
114
+ || !values.lastName
115
+ || !values.gender
116
+ || !values.dateOfBirth
117
+ || (!isMobileRegistration && !values.phone)
118
+ || !termsAndConditions
119
+ || !isHuman;
120
+ return (_jsxs(_Fragment, { children: [_jsx(ScreenLayout, { title: "Looks like you're new here!", subTitle: "Tell us more about you so we can set up your account.", buttonProps: {
121
+ loading,
122
+ label: 'Continue',
123
+ onClick: () => { handleSubmit({ onProceed }); },
124
+ disabled: isDisabled
125
+ }, onPressBack: onGoToLogin, children: _jsxs(Form, { form: form, className: "w-full", children: [_jsxs(Row, { gutter: 18, className: "py-0 my-0", children: [_jsx(Col, { xs: 24, md: 12, children: _jsx(Form.Item, { label: "First Name", rules: [
126
+ {
127
+ required: true,
128
+ message: 'Please enter your first name'
129
+ },
130
+ {
131
+ pattern: validationPatterns.nameOnly,
132
+ message: 'Name can only contain letters'
133
+ },
134
+ {
135
+ validator: async (_, value) => {
136
+ if (value && value.length < 3) {
137
+ throw new Error('Name must be at least 3 characters');
138
+ }
139
+ },
140
+ },
141
+ ], normalize: (value) => (value ?? '').replace(/[^a-zA-Z]/g, ''), ...form.register('firstName', {
142
+ onChange: (e) => handleFirstNameChange(e.target.value)
143
+ }), children: _jsx(TextInput, { placeholder: "Enter your first name" }) }) }), _jsx(Col, { xs: 24, md: 12, children: _jsx(Form.Item, { label: "Last Name", rules: [
144
+ {
145
+ required: true,
146
+ message: 'Please enter your last name'
147
+ },
148
+ {
149
+ pattern: validationPatterns.nameOnly,
150
+ message: 'Name can only contain letters'
151
+ },
152
+ {
153
+ validator: async (_, value) => {
154
+ if (value && value.length < 3) {
155
+ throw new Error('Name must be at least 3 characters');
156
+ }
157
+ },
158
+ },
159
+ ], normalize: (value) => (value ?? '').replace(/[^a-zA-Z]/g, ''), ...form.register('lastName', {
160
+ onChange: (e) => handleLastNameChange(e.target.value)
161
+ }), children: _jsx(TextInput, { placeholder: "Enter your last name" }) }) })] }), _jsxs(Row, { gutter: 18, className: "py-0 mt-4 relative", children: [_jsx(Col, { xs: 18, md: 19, children: _jsx(Typography, { type: "body", size: "large", className: "text-gray-700", children: "Your biological sex at the time of birth" }) }), _jsxs(Col, { xs: 6, md: 5, className: "flex justify-end group", children: [_jsx(Typography, { type: "body", size: "large", className: "text-primary cursor-pointer whitespace-nowrap", children: "Know More" }), _jsxs(Flex, { className: "hidden group-hover:block w-full absolute left-2 top-6 rounded-md p-4 z-10 text-gray-950 bg-white shadow-[0_0_10px_0_rgba(0,0,0,0.3)]", children: [_jsxs(Flex, { className: "p-0 mb-3 gap-3", children: [_jsx("img", { src: `${CDN_IMAGES_URL}/registration/gender-diversity.svg`, alt: "gender diversity", width: 44, height: 44, className: "h-auto" }), _jsxs(Typography, { type: "body", size: "large", className: "text-gray-800", children: ["The ", appName, " respects Gender Diversity & Inclusion!"] })] }), _jsxs(Typography, { type: "body", size: "small", className: "text-gray-500", children: [appName, " aims to provide you with a personalized wellness experience. This requires us to incorporate certain algorithms based on protocols provided by established health & medical institutions around the world. These protocols are based on your biological sex at birth."] })] })] })] }), _jsx(Row, { className: "py-0 mb-5", children: _jsx(Col, { children: _jsx(Form.Item, { className: "mt-4", rules: [
162
+ {
163
+ required: true,
164
+ message: 'Please select your biological sex'
165
+ }
166
+ ], ...form.register('gender', {
167
+ onChange: (e) => setGender(e.target.value)
168
+ }), children: _jsx(RadioGroup, { orientation: "horizontal", options: [
169
+ { label: 'Male', value: 'M' },
170
+ { label: 'Female', value: 'F' },
171
+ ] }) }) }) }), _jsxs(Row, { gutter: 18, className: "py-0 my-5", children: [_jsx(Col, { xs: 24, md: 24, lg: !isMobileRegistration ? 12 : 24, children: _jsx(Form.Item, { label: "Date of Birth", rules: [
172
+ {
173
+ required: true,
174
+ message: 'Please select your date of birth'
175
+ }
176
+ ], ...form.register('dateOfBirth', {
177
+ onChange: (value, dateString) => setSelectedDOB(dateString ?? (value?.toISOString ? value.toISOString() : String(value)))
178
+ }), children: _jsx(DatePicker, { required: true, size: "middle", format: "dd/MM/yyyy", placeholder: "DD/MM/YYYY",
179
+ /* @ts-ignore */
180
+ disabledDate: disabledDate, iconPosition: "right", defaultPickerValue: dayjs('1990-01-01').toDate(), suffixIcon: _jsx(CalendarDays, { className: "-mt-2" }) }) }) }), !isMobileRegistration &&
181
+ _jsx(Col, { xs: 24, md: 24, lg: 12, children: _jsx(Form.Item, { label: "Mobile Number", className: "mb-0", rules: [
182
+ {
183
+ required: true,
184
+ message: 'Please enter your mobile number'
185
+ }
186
+ ], ...form.register("phone", {
187
+ onChange: (e) => handleMobileChange(e.target.value)
188
+ }), 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) => {
189
+ setCountryCode(country.phoneCode);
190
+ setSelectedCountry(country);
191
+ } }) }) }) }) })] }), isMobileRegistration &&
192
+ _jsx(Col, { children: _jsx(Form.Item, { label: "Enter Your Email (Optional)", className: "mt-4", ...form.register('email', {
193
+ onChange: (e) => handleEmailChange(e.target.value)
194
+ }), children: _jsx(TextInput, { value: email, placeholder: "Enter Your Email (Optional)" }) }) }), _jsx(Col, { children: _jsx(Form.Item, { name: "referralCode", label: "Referral Code (Optional)", className: "mt-6", children: _jsx(TextInput, { placeholder: "Referral code", ...form.register('referralCode', {
195
+ onChange: (e) => setReferralCode(e.target.value)
196
+ }) }) }) }), isProduction && (process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY
197
+ ? _jsx(RecaptchaComponent, { onChange: handleCaptcha })
198
+ : _jsx(Typography, { type: "utility", size: "small", color: "red-600", children: "reCAPTCHA misconfigured. Set NEXT_PUBLIC_RECAPTCHA_SITE_KEY." })), _jsx(Row, { className: "py-0 my-5", children: _jsx(Col, { children: _jsx(CustomCheckbox, { checked: termsAndConditions, onClick: (e) => {
199
+ setTermsAndConditions(prev => !prev);
200
+ }, className: "mt-4", label: _jsxs(Typography, { type: "body", size: "medium", children: ["I accept the", _jsx("a", { target: "_blank", rel: "noopener noreferrer", href: termsAndConditionsUrl, className: "px-1 text-primary", children: "Terms & Conditions" }), "listed on ", appName] }) }) }) })] }) }), _jsxs(Flex, { align: 'center', className: 'p-0 mt-4', children: [_jsx(Typography, { type: "body", size: "large", className: "text-gray-700", children: "Already have an account?" }), _jsx(Button, { label: "Sign-In", variant: "link", size: "medium", className: "ml-2 h-auto px-0", onClick: onGoToLogin })] }), linkedAccountsSheet &&
201
+ _jsx(LinkedAccountsSheet, { phone: phone, countryCode: countryCode, visible: linkedAccountsSheet, hide: () => showLinkedAccountsSheet(false), linkedAccounts: linkedAccounts, getLoginTypeText: getLoginTypeText, onGoToLogin: onGoToLogin })] }));
202
+ };
203
+ const LinkedAccountsSheet = ({ visible, hide, linkedAccounts, countryCode, phone, getLoginTypeText, onGoToLogin }) => {
204
+ return (_jsxs(ResponsiveModal, { open: visible, onClose: hide, onOpenChange: hide, title: _jsxs(_Fragment, { children: [_jsx(Typography, { type: "heading", size: "h6", children: "Mobile Number Already Linked" }), _jsxs(Typography, { type: "utility", size: "medium", color: "gray-600", className: "mt-2 mb-3", children: ["The mobile number +", countryCode, " ", String(phone).replace(/\d(?=\d{2})/g, 'X'), " is linked to the following ", linkedAccounts.length === 1 ? 'account' : `${linkedAccounts.length} accounts`, "."] }), _jsx("hr", {})] }), centered: true, showCloseButton: false, className: "px-0", footer: _jsxs(Flex, { direction: "column", children: [_jsx(Button, { isFullWidth: true, variant: "primary", label: "Go to Login", onClick: () => {
205
+ onGoToLogin();
206
+ hide();
207
+ }, className: "!ml-0 mb-[-4px]" }), _jsx(SupportDetails, {})] }), children: [_jsx(Typography, { type: "utility", size: "medium", children: "Please login through any of the below account or contact our support team for assistance" }), linkedAccounts.map((item) => {
208
+ const key = item.memberId ?? item.email ?? `${item.loginType}-${item.createdOn}`;
209
+ return (_jsxs(Flex, { direction: "column", className: "border border-gray-300 p-4 rounded-md mt-3", children: [_jsxs(Flex, { direction: "column", className: "border-b-2 pb-2", 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(Flex, { justify: "between", className: "mt-3", children: [_jsx(Typography, { type: "utility", size: "medium", color: "gray-700", children: "Login Type" }), _jsx(Typography, { type: "utility", size: "medium", color: "gray-800", children: getLoginTypeText(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: moment(item.createdOn).format('DD/MM/YYYY') })] })] }, key));
210
+ })] }));
211
+ };
212
+ const RecaptchaComponent = React.memo(({ onChange }) => {
213
+ return (_jsx(Row, { gutter: 10, children: _jsx(Col, { span: 24, children: _jsx(ReCAPTCHA, { className: "g-recaptcha mt-4", sitekey: process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY || '', onChange: (token) => onChange(token ?? ''), onExpired: () => onChange(''), onErrored: () => onChange(''), size: "normal" }) }) }));
214
+ });
215
+ export { SignUpFormComponent };
@@ -0,0 +1,6 @@
1
+ const SignUpForm = () => {
2
+ if (__DEV__)
3
+ console.warn("[@truworth/twc-auth] SignUpWebComponent is web-only");
4
+ return null;
5
+ };
6
+ export { SignUpForm };
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Flex } from "@truworth/twc-web-design";
3
+ import { useEffect, useState } from "react";
4
+ import { AdvancedTransitionWrapper } from "../../../../components/AdvancedTransitionWrapper";
5
+ import { SignUpFormComponent } from "../SignUpForm";
6
+ import CreatePassword from "../../../CreatePassword";
7
+ import UserConsent from "../../../UserConsent";
8
+ import { useNavigator } from "../../../../hooks/useNavigator";
9
+ const SignUpWebComponent = () => {
10
+ const navigator = useNavigator();
11
+ const [signUpStep, setSignUpStep] = useState('registration');
12
+ const [userDetails, setUserDetails] = useState({});
13
+ const [registrationToken, setRegistrationToken] = useState('');
14
+ const [fbUserId, setFbUserId] = useState('');
15
+ const [googleUserId, setGoogleUserId] = useState('');
16
+ useEffect(() => {
17
+ const query = navigator.query;
18
+ const rawRegistrationToken = query.registrationToken;
19
+ const rawFbUserId = query.fbUserId;
20
+ const rawGoogleUserId = query.googleUserId;
21
+ if (typeof rawRegistrationToken === 'string') {
22
+ setRegistrationToken(rawRegistrationToken);
23
+ }
24
+ if (typeof rawFbUserId === 'string') {
25
+ setFbUserId(rawFbUserId);
26
+ }
27
+ if (typeof rawGoogleUserId === 'string') {
28
+ setGoogleUserId(rawGoogleUserId);
29
+ }
30
+ }, [navigator.query.registrationToken]);
31
+ const renderStep = () => {
32
+ switch (signUpStep) {
33
+ case 'registration':
34
+ return (_jsx(SignUpFormComponent, { userDetails: userDetails, onContinue: (userDetails) => {
35
+ if (registrationToken) {
36
+ setUserDetails({ ...userDetails, registrationToken, fbUserId, googleUserId });
37
+ setSignUpStep('user-consent');
38
+ return;
39
+ }
40
+ setUserDetails({ ...userDetails });
41
+ setSignUpStep('create-password');
42
+ } }));
43
+ case 'create-password':
44
+ return userDetails && (_jsx(CreatePassword, { userDetails: userDetails, handleBack: () => setSignUpStep('registration'), onContinue: (password, confirmPassword) => {
45
+ setUserDetails({ ...userDetails, password, confirmPassword });
46
+ setSignUpStep('user-consent');
47
+ } }));
48
+ case 'user-consent':
49
+ return (_jsx(UserConsent, { userDetails: userDetails, handleBack: () => {
50
+ if (registrationToken) {
51
+ setSignUpStep('registration');
52
+ return;
53
+ }
54
+ setSignUpStep('create-password');
55
+ } }));
56
+ default:
57
+ return null;
58
+ }
59
+ };
60
+ return (_jsx(AdvancedTransitionWrapper, { type: 'slide', duration: 0.5, children: _jsx(Flex, { direction: 'column', justify: 'center', className: `lg:w-[70%] lg:h-screen mx-auto h-full my-10`, children: renderStep() }) }));
61
+ };
62
+ export { SignUpWebComponent };
@@ -0,0 +1,6 @@
1
+ const SignUpWebComponent = () => {
2
+ if (__DEV__)
3
+ console.warn("[@truworth/twc-auth] SignUpWebComponent is web-only");
4
+ return null;
5
+ };
6
+ export { SignUpWebComponent };
@@ -0,0 +1,134 @@
1
+ import { useMemo, useState } from "react";
2
+ import { validateEmojiRegex } from "../../../../helpers/validation";
3
+ import { showMessage } from "../../../../helpers/show-message";
4
+ import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
5
+ import { RegistrationMethod } from "../../../../enums";
6
+ import { checkMobileExists, checkEmailExists } from "../../../../api/auth";
7
+ /**
8
+ * @internal
9
+ * Hook for managing SignUp screen state and auth context integration.
10
+ */
11
+ const useSignUp = () => {
12
+ const [loading, setLoading] = useState(false);
13
+ const [datePicker, showDatePicker] = useState(false);
14
+ const [linkedAccounts, setLinkedAccounts] = useState([]);
15
+ const [linkedAccountsSheet, showLinkedAccountsSheet] = useState(false);
16
+ const [firstName, setFirstName] = useState('');
17
+ const [lastName, setLastName] = useState('');
18
+ const [phone, setPhone] = useState('');
19
+ const [email, setEmail] = useState('');
20
+ const [gender, setGender] = useState('');
21
+ const [referralCode, setReferralCode] = useState('');
22
+ const [selectedDOB, setSelectedDOB] = useState('');
23
+ const [countryCode, setCountryCode] = useState('91');
24
+ const [error, setError] = useState({});
25
+ const { appConfig, registrationMethod, onRegistrationMethodChange } = useAuthPackageContext();
26
+ /** Initialize default values */
27
+ const initializeValues = (params) => {
28
+ setFirstName(params?.firstName || '');
29
+ setLastName(params?.lastName || '');
30
+ setCountryCode(params?.countryCode || '91');
31
+ };
32
+ /** Validate first name */
33
+ const handleFirstNameChange = (text) => {
34
+ text = validateEmojiRegex(text).replace(/[^A-Za-z]/g, '');
35
+ setFirstName(text);
36
+ };
37
+ /** Validate last name */
38
+ const handleLastNameChange = (text) => {
39
+ text = validateEmojiRegex(text).replace(/[^A-Za-z]/g, '');
40
+ setLastName(text);
41
+ };
42
+ /** Validate email input */
43
+ const handleEmailChange = (emailInput) => {
44
+ const emailRegex = /^(([^<>()\[\]\\.,;:\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,}))$/;
45
+ setEmail(emailInput);
46
+ setError(prev => ({ ...prev, email: !emailRegex.test(emailInput) }));
47
+ };
48
+ const handleMobileChange = (mobileInput) => {
49
+ setPhone(mobileInput);
50
+ const isNumeric = /^[0-9\b]+$/.test(mobileInput);
51
+ const isValid = (countryCode === '91' && isNumeric && mobileInput.length === 10) ||
52
+ (countryCode !== '91' && mobileInput.length > 5);
53
+ setError((prev) => ({ ...prev, phone: !isValid }));
54
+ };
55
+ /** Handle submit for signup */
56
+ const handleSubmit = async ({ onProceed }) => {
57
+ setLoading(true);
58
+ try {
59
+ if (phone) {
60
+ const { mobileExist, linkedAccounts = [] } = await checkMobileExists(phone);
61
+ if (mobileExist) {
62
+ setLinkedAccounts(linkedAccounts);
63
+ showLinkedAccountsSheet(true);
64
+ return;
65
+ }
66
+ }
67
+ if (email) {
68
+ const { emailExist } = await checkEmailExists(email);
69
+ if (emailExist) {
70
+ showMessage({ message: 'This email is already linked with another user.' });
71
+ return;
72
+ }
73
+ }
74
+ onProceed();
75
+ }
76
+ catch (err) {
77
+ const errorMessage = err?.response?.data?.errors?.[0]?.message ?? 'Something went wrong';
78
+ showMessage({ message: errorMessage });
79
+ }
80
+ finally {
81
+ setLoading(false);
82
+ }
83
+ };
84
+ /** Get display text for login type */
85
+ const getLoginTypeText = (loginType) => {
86
+ switch (loginType) {
87
+ case 1: return 'Email';
88
+ case 2: return 'Google';
89
+ case 3: return 'Facebook';
90
+ case 4: return 'Apple';
91
+ case 5: return 'Microsoft';
92
+ default: return 'Email';
93
+ }
94
+ };
95
+ /** Disable submit button logic */
96
+ const disabled = useMemo(() => {
97
+ const isPhoneInvalid = !phone || error.phone;
98
+ // Optional email: treat empty as valid; only flag when provided and invalid
99
+ const isEmailInvalid = email && error.email;
100
+ return (!firstName
101
+ || firstName.length < 3
102
+ || !lastName
103
+ || lastName.length < 3
104
+ || !selectedDOB
105
+ || !gender
106
+ || (registrationMethod === RegistrationMethod.MOBILE && isEmailInvalid)
107
+ || (registrationMethod !== RegistrationMethod.MOBILE && isPhoneInvalid));
108
+ }, [firstName, lastName, selectedDOB, gender, phone, email, error.phone, error.email, registrationMethod]);
109
+ return {
110
+ loading,
111
+ firstName, lastName,
112
+ gender, setGender,
113
+ datePicker, showDatePicker,
114
+ selectedDOB, setSelectedDOB,
115
+ phone, setPhone,
116
+ referralCode, setReferralCode,
117
+ countryCode, setCountryCode,
118
+ error, setError,
119
+ email, setEmail,
120
+ linkedAccounts,
121
+ linkedAccountsSheet, showLinkedAccountsSheet,
122
+ handleFirstNameChange, handleLastNameChange,
123
+ handleEmailChange,
124
+ handleMobileChange,
125
+ handleSubmit,
126
+ getLoginTypeText,
127
+ disabled,
128
+ registrationMethod, onRegistrationMethodChange,
129
+ appName: appConfig.appName,
130
+ termsAndConditionsUrl: appConfig.termsAndConditionsUrl,
131
+ initializeValues
132
+ };
133
+ };
134
+ export { useSignUp };
@@ -0,0 +1,6 @@
1
+ const SignUp = () => {
2
+ if (__DEV__)
3
+ console.warn("[@truworth/twc-auth] We use only SignUpWebComponent for login");
4
+ return null;
5
+ };
6
+ export default SignUp;