@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,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useEffect, useState } from 'react';
3
+ import { Button, DatePicker, TextInput, TextArea, UploadButton, Col, Form, Row, RadioGroup, Flex, Typography, showNotification, useForm } from '@truworth/twc-web-design';
4
+ import { Camera, Info, UserRound } from 'lucide-react';
5
+ import { useProfile } from '../../hooks/internal/useProfile';
6
+ import { MEMBER_IMAGES_URL } from '../../../../constants/cdn-url';
7
+ const EditProfile = ({ onSuccess }) => {
8
+ const { loading, profileData, imageUrl, setImageUrl, updateProfile, uploadProfileImage } = useProfile();
9
+ const [image, setImage] = useState(null);
10
+ const editProfileForm = useForm({
11
+ values: {
12
+ firstName: profileData?.firstName || '',
13
+ lastName: profileData?.lastName || '',
14
+ bio: profileData?.bio || '',
15
+ gender: profileData?.gender || '',
16
+ dateOfBirth: profileData?.dateOfBirth instanceof Date ? profileData.dateOfBirth : undefined
17
+ },
18
+ liveValidation: true
19
+ });
20
+ const handleSubmit = async ({ firstName, lastName, bio }) => {
21
+ const payload = {
22
+ firstName,
23
+ lastName
24
+ };
25
+ if (bio)
26
+ payload.bio = bio;
27
+ if (image) {
28
+ const uploadedFileName = await uploadProfileImage(image);
29
+ if (uploadedFileName) {
30
+ payload.image = uploadedFileName;
31
+ }
32
+ }
33
+ await updateProfile(payload, () => {
34
+ onSuccess?.();
35
+ localStorage.setItem('profileData', JSON.stringify({
36
+ firstName: payload.firstName,
37
+ lastName: payload.lastName,
38
+ image: payload.image ? `${MEMBER_IMAGES_URL}${payload.image}` : imageUrl
39
+ }));
40
+ });
41
+ };
42
+ const beforeUpload = async (files) => {
43
+ const file = files[0];
44
+ if (!file)
45
+ return false;
46
+ const validTypes = ['image/png', 'image/jpg', 'image/jpeg'];
47
+ const isValidType = validTypes.includes(file.type);
48
+ const isLt5M = file.size / 1024 / 1024 < 5;
49
+ if (!isValidType) {
50
+ showNotification({
51
+ type: 'error',
52
+ description: `${file.name} is not a valid image file`,
53
+ showIcon: false
54
+ });
55
+ return false;
56
+ }
57
+ if (!isLt5M) {
58
+ showNotification({
59
+ type: 'error',
60
+ description: 'Image must be smaller than 5 MB',
61
+ showIcon: false
62
+ });
63
+ return false;
64
+ }
65
+ const reader = new FileReader();
66
+ reader.onload = () => setImageUrl(reader.result);
67
+ reader.readAsDataURL(file);
68
+ setImage(file);
69
+ return false;
70
+ };
71
+ useEffect(() => {
72
+ window.scrollTo({ top: 0 });
73
+ }, []);
74
+ const firstName = editProfileForm.watch('firstName');
75
+ const lastName = editProfileForm.watch('lastName');
76
+ const bio = editProfileForm.watch('bio');
77
+ const isDisabled = firstName?.length > 2 && lastName?.length > 2;
78
+ return (_jsxs(Form, { form: editProfileForm, onSubmit: handleSubmit, children: [_jsxs("div", { className: "mb-8 pb-8 border-b border-gray-100", children: [_jsx(Typography, { type: "utility", size: "large", className: "text-gray-700 font-medium mb-4", children: "Profile Picture" }), _jsxs(Flex, { align: "center", className: "gap-6", children: [_jsxs("div", { className: "relative group", children: [_jsx("div", { className: "w-24 h-24 rounded-2xl bg-gray-100 flex items-center justify-center overflow-hidden border-2 border-gray-200", children: !imageUrl ? (_jsx(UserRound, { size: 40, className: "text-gray-400" })) : (_jsx("img", { src: imageUrl, alt: "Profile", className: "w-full h-full object-cover" })) }), _jsx("div", { className: "absolute inset-0 rounded-2xl bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: _jsx(UploadButton, { files: [], accept: ".png,.jpg,.jpeg", leftIcon: _jsx(Camera, { size: 24, className: "text-white" }), size: "small", buttonStyle: "border-0 p-0 bg-transparent hover:bg-transparent", onUpload: (files) => beforeUpload(files), showAttachments: false }) })] }), _jsxs("div", { children: [_jsx(Typography, { type: "body", size: "medium", className: "text-gray-900 font-medium", children: "Upload a new photo" }), _jsx(Typography, { type: "body", size: "small", className: "text-gray-500 mt-1", children: "JPG, PNG or JPEG. Max size 5MB" }), _jsx(UploadButton, { files: [], accept: ".png,.jpg,.jpeg", label: "Choose File", size: "small", buttonStyle: "mt-3 border-gray-300 text-gray-700 hover:bg-gray-50", onUpload: (files) => beforeUpload(files), showAttachments: false })] })] })] }), _jsxs("div", { className: "mb-8 pb-8 border-b border-gray-100", children: [_jsx(Typography, { type: "utility", size: "large", className: "text-gray-700 font-medium mb-4", children: "Personal Information" }), _jsxs(Row, { gutter: 20, children: [_jsx(Col, { md: 12, xs: 24, children: _jsx(Form.Item, { label: "First Name", name: "firstName", rules: [{
79
+ required: true,
80
+ message: 'Enter at least 3 letters.'
81
+ }], children: _jsx(TextInput, { placeholder: "Enter first name", className: "rounded-xl h-12" }) }) }), _jsx(Col, { md: 12, xs: 24, children: _jsx(Form.Item, { label: "Last Name", name: "lastName", rules: [{
82
+ required: true,
83
+ message: 'Enter at least 3 letters.'
84
+ }], children: _jsx(TextInput, { placeholder: "Enter last name", className: "rounded-xl h-12" }) }) })] })] }), _jsxs("div", { className: "mb-8 pb-8 border-b border-gray-100", children: [_jsx(Typography, { type: "utility", size: "large", className: "text-gray-700 font-medium mb-4", children: "Additional Details" }), _jsxs(Row, { gutter: 20, children: [_jsx(Col, { md: 12, xs: 24, children: _jsx(Form.Item, { label: _jsx("span", { className: "text-gray-500", children: "Gender" }), name: "gender", children: _jsx(RadioGroup, { disabled: true, orientation: "horizontal", options: [
85
+ { label: 'Male', value: 'M' },
86
+ { label: 'Female', value: 'F' }
87
+ ] }) }) }), _jsx(Col, { md: 12, xs: 24, children: _jsx(Form.Item, { label: _jsx("span", { className: "text-gray-500", children: "Date of Birth" }), name: "dateOfBirth", children: _jsx(DatePicker, { disabled: true, format: "dd/MM/yyyy", iconPosition: "right", className: "!bg-gray-50 rounded-xl h-12" }) }) })] }), _jsxs(Flex, { align: "center", className: "gap-2 p-3 bg-amber-50 rounded-xl border border-amber-100", children: [_jsx(Info, { size: 16, className: "text-amber-600 flex-shrink-0" }), _jsx(Typography, { type: "body", size: "small", className: "text-amber-800", children: "Please contact support to update Gender or Date of Birth." })] })] }), _jsxs("div", { className: "mb-8", children: [_jsx(Typography, { type: "utility", size: "large", className: "text-gray-700 font-medium mb-4", children: "About You" }), _jsx(Form.Item, { label: "Bio", name: "bio", children: _jsx(TextArea, { maxCount: 150, placeholder: "Tell us a bit about yourself..." }) })] }), _jsx(Flex, { justify: "end", className: "pt-4 border-t border-gray-100", children: _jsx(Button, { type: "submit", loading: loading, disabled: !isDisabled, className: "px-8", size: "large", children: "Save Changes" }) })] }));
88
+ };
89
+ export { EditProfile };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { View, Text } from 'react-native';
4
+ // Native implementation placeholder
5
+ const EditProfile = () => {
6
+ return (_jsx(View, { children: _jsx(Text, { children: "Edit Profile - Native Implementation" }) }));
7
+ };
8
+ export { EditProfile };
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useEffect, useState, useCallback } from 'react';
3
+ import { Button, Typography, ResponsiveModal, OTPInput } from '@truworth/twc-web-design';
4
+ import { useProfile } from '../../hooks/internal/useProfile';
5
+ const OtpVerificationModal = ({ open, onOpenChange, phone, onSuccess, successMessage = 'Mobile number updated', title = 'Confirm Mobile Number' }) => {
6
+ const { loading, sendMobileOtp, verifyMobileOtp } = useProfile();
7
+ const [otp, setOtp] = useState('');
8
+ const [otpError, setOtpError] = useState(false);
9
+ const [resendTimer, setResendTimer] = useState(180);
10
+ const [timeLeft, setTimeLeft] = useState('03:00');
11
+ // Timer countdown
12
+ useEffect(() => {
13
+ if (!resendTimer)
14
+ return;
15
+ const intervalId = setInterval(() => {
16
+ const minute = Math.floor(resendTimer / 60);
17
+ const seconds = resendTimer % 60;
18
+ const formattedTime = `${minute < 10 ? '0' : ''}${minute}:${seconds < 10 ? '0' : ''}${seconds}`;
19
+ setTimeLeft(formattedTime);
20
+ setResendTimer(prev => prev - 1);
21
+ }, 1000);
22
+ return () => clearInterval(intervalId);
23
+ }, [resendTimer]);
24
+ // Send OTP when modal opens
25
+ useEffect(() => {
26
+ if (open) {
27
+ sendMobileOtp();
28
+ setResendTimer(180);
29
+ setOtp('');
30
+ setOtpError(false);
31
+ }
32
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33
+ }, [open]);
34
+ const handleChange = useCallback((code) => {
35
+ setOtp(code);
36
+ setOtpError(false);
37
+ }, []);
38
+ const handleVerify = useCallback(() => {
39
+ setOtpError(false);
40
+ verifyMobileOtp(otp, () => {
41
+ onOpenChange(false);
42
+ onSuccess?.();
43
+ }, () => {
44
+ setOtpError(true);
45
+ });
46
+ }, [otp, verifyMobileOtp, onOpenChange, onSuccess]);
47
+ const handleResend = useCallback(() => {
48
+ setResendTimer(180);
49
+ setOtpError(false);
50
+ setOtp('');
51
+ sendMobileOtp();
52
+ }, [sendMobileOtp]);
53
+ const handleClose = useCallback(() => {
54
+ setOtp('');
55
+ setOtpError(false);
56
+ onOpenChange(false);
57
+ }, [onOpenChange]);
58
+ const maskedPhone = phone ? `XXXXXXX${phone.slice(-3)}` : '';
59
+ return (_jsxs(ResponsiveModal, { size: "sm", title: _jsx(Typography, { type: "heading", size: "h6", children: title }), footer: null, open: open, showCloseButton: false, onOpenChange: handleClose, children: [_jsxs(Typography, { type: "body", size: "large", className: "mb-7 text-gray-400 text-center", children: ["OTP sent to", _jsx("span", { className: "pl-2 text-secondary-dark", children: maskedPhone })] }), _jsx(OTPInput, { className: "!w-full", onChange: handleChange, error: otpError, maxLength: 6, value: otp }), otpError && (_jsx(Typography, { type: "body", size: "medium", className: "text-utility-danger-main mt-2", children: "Please enter the correct OTP." })), resendTimer < 60 ? (_jsxs("div", { className: "flex justify-between items-center my-7", children: [_jsx(Typography, { type: "utility", size: "medium", className: "text-gray-400", children: "Didn't receive OTP?" }), _jsx(Button, { size: "small", variant: "link", onClick: handleResend, children: "Resend Code" })] })) : (_jsxs(Typography, { type: "utility", size: "medium", className: "my-7 text-gray-400", children: ["Resend Code in ", timeLeft] })), _jsx(Button, { isFullWidth: true, onClick: handleVerify, loading: loading, disabled: otp.length < 6, children: "Continue" })] }));
60
+ };
61
+ export { OtpVerificationModal };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ // Native implementation placeholder
3
+ // For mobile, OTP verification would typically use a different flow
4
+ const OtpVerificationModal = () => {
5
+ return null;
6
+ };
7
+ export { OtpVerificationModal };
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState } from 'react';
3
+ import { AvatarWithInitials, ResponsiveModal, Button, Flex, Typography } from '@truworth/twc-web-design';
4
+ import { Lock, Phone, UserRound, Loader2, ChevronRight } from 'lucide-react';
5
+ import { EditProfile } from '../EditProfile';
6
+ import { EditMobileNumber } from '../EditMobileNumber';
7
+ import { EditPassword } from '../EditPassword';
8
+ import { useProfile } from '../../hooks/internal/useProfile';
9
+ import { useAuthContext } from '../../../../hooks/useAuthContext';
10
+ const tabs = [
11
+ {
12
+ key: 'edit-profile',
13
+ label: 'Edit Profile',
14
+ icon: _jsx(UserRound, { className: "w-5 h-5" })
15
+ },
16
+ {
17
+ key: 'mobile-number',
18
+ label: 'Mobile Number',
19
+ icon: _jsx(Phone, { className: "w-5 h-5" })
20
+ },
21
+ {
22
+ key: 'password',
23
+ label: 'Password',
24
+ icon: _jsx(Lock, { className: "w-5 h-5" })
25
+ }
26
+ ];
27
+ const ProfileWebComponent = ({ onProfileUpdate, onMobileUpdate, onPasswordUpdate, containerClassName = '' }) => {
28
+ const { isLoadingProfile } = useAuthContext();
29
+ const { profile, profileData } = useProfile();
30
+ const [activeTab, setActiveTab] = useState('edit-profile');
31
+ const [showUnsavedModal, setShowUnsavedModal] = useState(false);
32
+ const [pendingTab, setPendingTab] = useState(null);
33
+ const [hasDirtyForm, setHasDirtyForm] = useState(false);
34
+ // Show loading state while profile is being fetched
35
+ if (isLoadingProfile && !profile) {
36
+ return (_jsx("div", { className: containerClassName, children: _jsx(Flex, { justify: "center", align: "center", className: "py-20", children: _jsx(Loader2, { className: "w-8 h-8 animate-spin text-primary" }) }) }));
37
+ }
38
+ const fullName = `${profile?.firstName || ''} ${profile?.lastName || ''}`.trim();
39
+ const handleTabChange = (key) => {
40
+ if (hasDirtyForm) {
41
+ setShowUnsavedModal(true);
42
+ setPendingTab(key);
43
+ }
44
+ else {
45
+ setActiveTab(key);
46
+ }
47
+ };
48
+ const handleConfirmLeave = () => {
49
+ setHasDirtyForm(false);
50
+ if (pendingTab) {
51
+ setActiveTab(pendingTab);
52
+ setPendingTab(null);
53
+ }
54
+ setShowUnsavedModal(false);
55
+ };
56
+ const renderTabContent = () => {
57
+ switch (activeTab) {
58
+ case 'edit-profile':
59
+ return _jsx(EditProfile, { onSuccess: onProfileUpdate });
60
+ case 'mobile-number':
61
+ return _jsx(EditMobileNumber, { onSuccess: onMobileUpdate });
62
+ case 'password':
63
+ return _jsx(EditPassword, { onSuccess: onPasswordUpdate });
64
+ default:
65
+ return null;
66
+ }
67
+ };
68
+ return (_jsxs("div", { className: `max-w-5xl mx-auto ${containerClassName}`, children: [_jsxs("div", { className: "mb-6", children: [_jsx(Typography, { type: "heading", size: "h4", className: "text-gray-900", children: "Account Settings" }), _jsx(Typography, { type: "body", size: "medium", className: "text-gray-500 mt-1", children: "Manage your profile and preferences" })] }), _jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-6", children: [_jsxs("div", { className: "lg:col-span-4 space-y-4", children: [_jsx("div", { className: "bg-white rounded-2xl border border-gray-100 p-5 shadow-sm", children: _jsxs(Flex, { align: "center", className: "gap-4", children: [_jsxs("div", { className: "relative", children: [_jsx(AvatarWithInitials, { size: "large", name: fullName || 'User', url: profileData?.image, className: "w-16 h-16 text-xl" }), _jsx("div", { className: "absolute -bottom-1 -right-1 w-5 h-5 bg-green-500 rounded-full border-2 border-white" })] }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx(Typography, { type: "body", size: "large", className: "font-semibold text-gray-900 truncate", children: fullName || 'Welcome' }), _jsx(Typography, { type: "body", size: "small", className: "text-gray-500 truncate", children: profile?.email })] })] }) }), _jsx("div", { className: "bg-white rounded-2xl border border-gray-100 overflow-hidden shadow-sm", children: _jsx("nav", { className: "p-2", children: tabs.map((tab) => (_jsxs("button", { onClick: () => handleTabChange(tab.key), className: `
69
+ w-full flex items-center gap-3 px-4 py-3 rounded-xl text-left transition-all duration-200
70
+ ${activeTab === tab.key
71
+ ? 'bg-primary/10'
72
+ : 'hover:bg-gray-50'}
73
+ `, children: [_jsx("div", { className: `
74
+ w-9 h-9 rounded-lg flex items-center justify-center transition-colors
75
+ ${activeTab === tab.key
76
+ ? 'bg-primary text-white'
77
+ : 'bg-gray-100 text-gray-500'}
78
+ `, children: tab.icon }), _jsx("div", { className: "flex-1 min-w-0", children: _jsx(Typography, { type: "body", size: "medium", className: `font-medium ${activeTab === tab.key ? 'text-primary' : 'text-gray-900'}`, children: tab.label }) }), _jsx(ChevronRight, { className: `w-4 h-4 transition-colors ${activeTab === tab.key ? 'text-primary' : 'text-gray-300'}` })] }, tab.key))) }) })] }), _jsx("div", { className: "lg:col-span-8", children: _jsx("div", { className: "bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden", children: _jsx("div", { className: "p-6 lg:p-8", children: renderTabContent() }) }) })] }), _jsx(ResponsiveModal, { title: "", size: "sm", open: showUnsavedModal, footer: null, showCloseButton: false, onClose: () => setShowUnsavedModal(false), onOpenChange: () => setShowUnsavedModal(false), children: _jsxs(Flex, { direction: "column", align: "center", className: "py-6", children: [_jsx("div", { className: "w-16 h-16 rounded-full bg-amber-100 flex items-center justify-center mb-4", children: _jsx("svg", { className: "w-8 h-8 text-amber-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }) }), _jsx(Typography, { type: "heading", size: "h6", className: "mb-2 text-gray-900", children: "Unsaved Changes" }), _jsx(Typography, { type: "body", size: "medium", className: "text-gray-500 text-center mb-6", children: "You have unsaved changes. Are you sure you want to leave?" }), _jsxs(Flex, { className: "gap-3 w-full", children: [_jsx(Button, { isFullWidth: true, variant: "outline", onClick: () => setShowUnsavedModal(false), children: "Stay" }), _jsx(Button, { isFullWidth: true, onClick: handleConfirmLeave, children: "Leave" })] })] }) })] }));
79
+ };
80
+ export { ProfileWebComponent };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ // Native implementation - Profile is typically handled differently on mobile
3
+ const ProfileWebComponent = () => {
4
+ if (process.env.NODE_ENV !== 'production') {
5
+ console.warn('[@truworth/twc-auth] ProfileWebComponent is only available for web');
6
+ }
7
+ return null;
8
+ };
9
+ export { ProfileWebComponent };
@@ -0,0 +1,185 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { useAuthContext } from '../../../../hooks/useAuthContext';
3
+ import { useRequest } from '../../../../hooks/useRequest';
4
+ import { showMessage } from '../../../../helpers/show-message';
5
+ import { parseISO } from 'date-fns';
6
+ const useProfile = () => {
7
+ const { profile, getUserProfile } = useAuthContext();
8
+ const { makeRequest } = useRequest();
9
+ const [loading, setLoading] = useState(false);
10
+ const [imageUrl, setImageUrl] = useState('');
11
+ const [profileData, setProfileData] = useState({
12
+ firstName: '',
13
+ lastName: '',
14
+ dateOfBirth: new Date(),
15
+ gender: '',
16
+ phone: '',
17
+ bio: '',
18
+ image: '',
19
+ countryCode: '91'
20
+ });
21
+ useEffect(() => {
22
+ if (profile) {
23
+ const dob = profile.dateOfBirth && typeof profile.dateOfBirth === 'string'
24
+ ? parseISO(profile.dateOfBirth)
25
+ : profile.dateOfBirth || new Date();
26
+ setProfileData({
27
+ firstName: profile.firstName || '',
28
+ lastName: profile.lastName || '',
29
+ gender: profile.gender || '',
30
+ dateOfBirth: dob,
31
+ image: profile.image || '',
32
+ phone: profile.phone || '',
33
+ bio: profile.bio || '',
34
+ countryCode: profile.countryCode || '91'
35
+ });
36
+ if (profile.image) {
37
+ setImageUrl(profile.image);
38
+ }
39
+ }
40
+ }, [profile]);
41
+ const updateProfile = async (data, onSuccess) => {
42
+ setLoading(true);
43
+ try {
44
+ await makeRequest({
45
+ url: '/user/profile',
46
+ method: 'POST',
47
+ body: data,
48
+ onSuccess: () => {
49
+ showMessage({ message: 'Your profile information is updated.' });
50
+ getUserProfile?.();
51
+ onSuccess?.();
52
+ },
53
+ onFailure: () => {
54
+ showMessage({ message: 'Failed to update profile.' });
55
+ }
56
+ });
57
+ }
58
+ finally {
59
+ setLoading(false);
60
+ }
61
+ };
62
+ const uploadProfileImage = async (file) => {
63
+ const fileData = new FormData();
64
+ fileData.append('file', file);
65
+ try {
66
+ const response = await makeRequest({
67
+ url: '/upload/profile-picture',
68
+ method: 'POST',
69
+ body: fileData,
70
+ headers: {
71
+ 'Content-Type': 'multipart/form-data'
72
+ }
73
+ });
74
+ return response?.fileName || null;
75
+ }
76
+ catch {
77
+ showMessage({ message: 'Failed to upload image.' });
78
+ return null;
79
+ }
80
+ };
81
+ const updateMobileNumber = async (data, onSuccess, onFailure) => {
82
+ setLoading(true);
83
+ try {
84
+ await makeRequest({
85
+ url: '/user/mobile-number',
86
+ method: 'POST',
87
+ body: data,
88
+ onSuccess: () => {
89
+ onSuccess?.();
90
+ },
91
+ onFailure: () => {
92
+ showMessage({ message: 'Failed to update mobile number.' });
93
+ onFailure?.();
94
+ }
95
+ });
96
+ }
97
+ finally {
98
+ setLoading(false);
99
+ }
100
+ };
101
+ const sendMobileOtp = async (onSuccess, onFailure) => {
102
+ try {
103
+ await makeRequest({
104
+ url: '/auth/mobile/send-otp',
105
+ method: 'POST',
106
+ onSuccess: () => onSuccess?.(),
107
+ onFailure: () => onFailure?.()
108
+ });
109
+ }
110
+ catch {
111
+ onFailure?.();
112
+ }
113
+ };
114
+ const verifyMobileOtp = async (otp, onSuccess, onFailure) => {
115
+ setLoading(true);
116
+ try {
117
+ await makeRequest({
118
+ url: '/auth/mobile/verify-otp',
119
+ method: 'POST',
120
+ body: { otp },
121
+ onSuccess: () => {
122
+ showMessage({ message: 'Mobile number updated successfully.' });
123
+ getUserProfile?.();
124
+ onSuccess?.();
125
+ },
126
+ onFailure: () => {
127
+ onFailure?.();
128
+ }
129
+ });
130
+ }
131
+ finally {
132
+ setLoading(false);
133
+ }
134
+ };
135
+ const changePassword = async (data, onSuccess, onFailure) => {
136
+ setLoading(true);
137
+ try {
138
+ // First, validate current password
139
+ const initResponse = await makeRequest({
140
+ url: '/auth/change-password/initialize-session',
141
+ method: 'POST',
142
+ body: { password: data.currentPassword }
143
+ });
144
+ if (initResponse?.token) {
145
+ // Then change the password
146
+ await makeRequest({
147
+ url: '/auth/change-password',
148
+ method: 'POST',
149
+ body: { password: data.newPassword, token: initResponse.token },
150
+ onSuccess: () => {
151
+ showMessage({ message: 'Your password has been updated.' });
152
+ onSuccess?.();
153
+ },
154
+ onFailure: () => {
155
+ showMessage({ message: 'Failed to change password.' });
156
+ onFailure?.();
157
+ }
158
+ });
159
+ }
160
+ else {
161
+ onFailure?.('Invalid current password');
162
+ }
163
+ }
164
+ catch {
165
+ onFailure?.('Current password is incorrect');
166
+ }
167
+ finally {
168
+ setLoading(false);
169
+ }
170
+ };
171
+ return {
172
+ loading,
173
+ profile,
174
+ profileData,
175
+ imageUrl,
176
+ setImageUrl,
177
+ updateProfile,
178
+ uploadProfileImage,
179
+ updateMobileNumber,
180
+ sendMobileOtp,
181
+ verifyMobileOtp,
182
+ changePassword
183
+ };
184
+ };
185
+ export { useProfile };
@@ -0,0 +1,6 @@
1
+ export { ProfileWebComponent } from './components/ProfileWebComponent';
2
+ export { EditProfile } from './components/EditProfile';
3
+ export { EditMobileNumber } from './components/EditMobileNumber';
4
+ export { EditPassword } from './components/EditPassword';
5
+ export { OtpVerificationModal } from './components/OtpVerificationModal';
6
+ export { useProfile } from './hooks/internal/useProfile';
@@ -0,0 +1,6 @@
1
+ export { ProfileWebComponent } from './components/ProfileWebComponent/index.native';
2
+ export { EditProfile } from './components/EditProfile/index.native';
3
+ export { EditMobileNumber } from './components/EditMobileNumber/index.native';
4
+ export { EditPassword } from './components/EditPassword/index.native';
5
+ export { OtpVerificationModal } from './components/OtpVerificationModal/index.native';
6
+ export { useProfile } from './hooks/internal/useProfile';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,57 @@
1
+ import { useState } from "react";
2
+ import { showMessage } from "../../../../helpers/show-message";
3
+ import { axiosClient } from "../../../../api/axiosClient";
4
+ import { defaultPolicy } from "../../../../constants/defaultPolicy";
5
+ /**
6
+ * @internal
7
+ * Hook for managing ResetPassword screen state and auth context integration.
8
+ * This hook is not exposed to package consumers.
9
+ */
10
+ const useResetPassword = ({ sessionToken }) => {
11
+ const [loading, setLoading] = useState(false);
12
+ const [passwordVisible, setPasswordVisible] = useState(false);
13
+ const [confirmPasswordVisible, setConfirmPasswordVisible] = useState(false);
14
+ const [password, setPassword] = useState('');
15
+ const [confirmPassword, setConfirmPassword] = useState('');
16
+ const [maxLength, setMaxLength] = useState(defaultPolicy.maxLength);
17
+ const [criteria, setCriteria] = useState({});
18
+ const handlePassword = (text) => {
19
+ setPassword(text.replace(/\s/g, ''));
20
+ };
21
+ const handleConfirmPassword = (text) => {
22
+ setConfirmPassword(text.replace(/\s/g, ''));
23
+ };
24
+ const handleContinue = ({ onResult }) => {
25
+ setLoading(true);
26
+ axiosClient({
27
+ url: '/auth/reset-password',
28
+ method: 'POST',
29
+ data: { sessionToken, password },
30
+ }).then(() => {
31
+ showMessage({ message: 'Password updated successfully. Please login with your new credentials.', type: 'success' });
32
+ onResult();
33
+ }).catch((err) => {
34
+ console.log(err);
35
+ if (err?.response?.status === 401) {
36
+ showMessage({ message: 'Your session expired. Please request a new OTP.' });
37
+ return;
38
+ }
39
+ showMessage({ message: err?.response?.data?.errors?.[0]?.message || 'An unexpected error occurred' });
40
+ }).finally(() => setLoading(false));
41
+ };
42
+ const isContinueDisabled = !Object.keys(criteria).every(c => criteria[c]) || (password !== confirmPassword);
43
+ return {
44
+ loading,
45
+ password, setPassword,
46
+ confirmPassword, setConfirmPassword,
47
+ passwordVisible, setPasswordVisible,
48
+ confirmPasswordVisible, setConfirmPasswordVisible,
49
+ maxLength, setMaxLength,
50
+ criteria, setCriteria,
51
+ handlePassword,
52
+ handleContinue,
53
+ handleConfirmPassword,
54
+ isContinueDisabled
55
+ };
56
+ };
57
+ export { useResetPassword };
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Flex, Form, PasswordInput, useForm } from "@truworth/twc-web-design";
3
+ import { useResetPassword } from "./hooks/internal/useResetPassword";
4
+ import { ScreenLayout } from "../../components/ScreenLayout";
5
+ import { PasswordCriteria } from "../../components/PasswordCriteria";
6
+ const ResetPassword = ({ email, sessionToken, onPressBack, onContinue }) => {
7
+ const form = useForm({
8
+ defaultValues: {
9
+ password: '',
10
+ confirmPassword: '',
11
+ }
12
+ });
13
+ const { password, confirmPassword } = form.watch();
14
+ const { loading, criteria, setCriteria, maxLength, setMaxLength, handlePassword, handleConfirmPassword, handleContinue, isContinueDisabled } = useResetPassword({ sessionToken });
15
+ return (_jsx(ScreenLayout, { title: "Reset your Password", subTitle: "Use a password that\u2019s easy to remember and fulfills all the requirements listed below.", buttonProps: {
16
+ loading,
17
+ label: 'Continue',
18
+ onClick: () => handleContinue({ onResult: onContinue }),
19
+ disabled: isContinueDisabled
20
+ }, onPressBack: onPressBack, children: _jsx(Flex, { direction: "column", children: _jsxs(Form, { form: form, className: "w-full", children: [_jsx(Form.Item, { label: "Enter Password", normalize: (value) => value.replace(/\s/g, ''), rules: [
21
+ {
22
+ required: true,
23
+ message: 'Please enter your password'
24
+ }
25
+ ], ...form.register('password', {
26
+ onChange: (e) => handlePassword(e.target.value)
27
+ }), children: _jsx(PasswordInput, { placeholder: "Enter password", value: password, maxLength: maxLength, showStrengthIndicator: false }) }), _jsx(PasswordCriteria, { email: email, password: password, criteria: criteria, onCriteriaChange: setCriteria, onMaxLengthChange: setMaxLength }), _jsx(Form.Item, { label: "Confirm Password", className: "mt-6", normalize: (value) => value.replace(/\s/g, ''), rules: [
28
+ {
29
+ required: true,
30
+ message: 'Please confirm your password',
31
+ },
32
+ {
33
+ validator: async (_, value) => {
34
+ const password = form.getValues('password');
35
+ if (!value)
36
+ return;
37
+ if (password !== value) {
38
+ throw new Error('Passwords don’t match');
39
+ }
40
+ },
41
+ },
42
+ ], ...form.register('confirmPassword', {
43
+ onChange: (e) => handleConfirmPassword(e.target.value)
44
+ }), children: _jsx(PasswordInput, { className: "mb-6", value: confirmPassword, placeholder: "Re-enter password", maxLength: maxLength, showStrengthIndicator: false }) })] }) }) }));
45
+ };
46
+ export default ResetPassword;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Colors, TextInputField } from '@truworth/twc-rn-common';
3
+ import { Layout } from '@ui-kitten/components';
4
+ import { ScreenLayout } from '../../components/ScreenLayout';
5
+ import { useResetPassword } from './hooks/internal/useResetPassword';
6
+ import { PasswordCriteria } from '../../components/PasswordCriteria/index.native';
7
+ const { primary } = Colors;
8
+ const ResetPassword = ({ navigation, route }) => {
9
+ const { sessionToken, email } = route.params || {};
10
+ const { loading, password, confirmPassword, passwordVisible, setPasswordVisible, confirmPasswordVisible, setConfirmPasswordVisible, maxLength, setMaxLength, criteria, setCriteria, handlePassword, handleContinue, handleConfirmPassword, isContinueDisabled } = useResetPassword({ sessionToken });
11
+ return (_jsx(Layout, { style: { flex: 1, backgroundColor: primary.white }, children: _jsxs(ScreenLayout, { title: "Reset your Password", subTitle: "Use a password that\u2019s easy to remember and fulfills all the requirements listed below.", buttonProps: {
12
+ loading,
13
+ label: 'Continue',
14
+ onPress: () => {
15
+ handleContinue({
16
+ onResult: () => navigation.navigate('EnterEmail')
17
+ });
18
+ },
19
+ disabled: isContinueDisabled
20
+ }, children: [_jsx(TextInputField, { placeholder: "Enter password...", onChangeValue: handlePassword, secureTextEntry: !passwordVisible, value: password, rightIcon2: passwordVisible
21
+ ? 'eye-outline'
22
+ : 'eye-off-outline', onPressRightIcon2: () => setPasswordVisible(!passwordVisible), autoFocus: true, maxLength: maxLength }), _jsx(PasswordCriteria, { email: email, criteria: criteria, onCriteriaChange: setCriteria, onMaxLengthChange: setMaxLength, password: password }), _jsx(TextInputField, { placeholder: "Confirm password...", onChangeValue: handleConfirmPassword, secureTextEntry: !confirmPasswordVisible, value: confirmPassword, rightIcon2: confirmPasswordVisible
23
+ ? 'eye-outline'
24
+ : 'eye-off-outline', onPressRightIcon2: () => setConfirmPasswordVisible(!confirmPasswordVisible), maxLength: maxLength, containerStyle: { marginTop: 16 } })] }) }));
25
+ };
26
+ export default ResetPassword;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ const SSOAuthWebView = () => {
2
+ if (process.env.NODE_ENV !== 'production') {
3
+ if (typeof window !== 'undefined') {
4
+ console.warn("[@truworth/twc-auth] SSOAuthWebView is only available for native app screens");
5
+ }
6
+ }
7
+ return null;
8
+ };
9
+ export default SSOAuthWebView;