@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.
- package/build/assets/animation/redirect-home.json +1101 -0
- package/build/assets/cross_icon copy.svg +5 -0
- package/build/assets/cross_icon.svg +5 -0
- package/build/assets/email_icon.svg +6 -0
- package/build/assets/gender-diversity.svg +22 -0
- package/build/assets/loading-spinner.json +1 -0
- package/build/assets/logo.svg +55 -0
- package/build/assets/okay_icon.svg +3 -0
- package/build/src/api/auth.js +36 -0
- package/build/src/api/axiosClient/index.js +5 -0
- package/build/src/api/axiosClient/index.native.js +5 -0
- package/build/src/components/AdvancedTransitionWrapper/index.js +374 -0
- package/build/src/components/AdvancedTransitionWrapper/index.native.js +10 -0
- package/build/src/components/AdvancedTransitionWrapper/types.js +1 -0
- package/build/src/components/ConfirmationModal/index.js +11 -0
- package/build/src/components/ConfirmationModal/index.native.js +15 -0
- package/build/src/components/ConfirmationModal/types.js +1 -0
- package/build/src/components/IonIcon/index.js +11 -0
- package/build/src/components/IonIcon/index.native.js +9 -0
- package/build/src/components/IonIcon/types.js +1 -0
- package/build/src/components/LoadingAnimation/index.js +50 -0
- package/build/src/components/OTPStatusLabel/index.js +10 -0
- package/build/src/components/OTPStatusLabel/index.native.js +21 -0
- package/build/src/components/OTPStatusLabel/types.js +1 -0
- package/build/src/components/PasswordCriteria/hooks/usePasswordCriteria.js +71 -0
- package/build/src/components/PasswordCriteria/index.js +47 -0
- package/build/src/components/PasswordCriteria/index.native.js +22 -0
- package/build/src/components/PasswordCriteria/types.js +1 -0
- package/build/src/components/ScreenLayout/index.js +12 -0
- package/build/src/components/ScreenLayout/index.native.js +18 -0
- package/build/src/components/ScreenLayout/types.js +1 -0
- package/build/src/components/SupportDetails/index.js +9 -0
- package/build/src/components/SupportDetails/index.native.js +6 -0
- package/build/src/components/VerifyEmailOTP/index.js +20 -0
- package/build/src/components/VerifyEmailOTP/index.native.js +22 -0
- package/build/src/components/VerifyEmailOTP/types.js +1 -0
- package/build/src/components/VerifyMobileOTP/index.js +25 -0
- package/build/src/components/VerifyMobileOTP/index.native.js +38 -0
- package/build/src/components/VerifyMobileOTP/types.js +1 -0
- package/build/src/constants/base-url/index.js +5 -0
- package/build/src/constants/base-url/index.native.js +1 -0
- package/build/src/constants/cdn-url/index.js +2 -0
- package/build/src/constants/cdn-url/index.native.js +5 -0
- package/build/src/constants/defaultPolicy.js +9 -0
- package/build/src/constants/password-requirements.js +7 -0
- package/build/src/constants/social-login-options.js +16 -0
- package/build/src/contexts/AuthContext.js +192 -0
- package/build/src/contexts/type.js +1 -0
- package/build/src/enums/index.js +3 -0
- package/build/src/enums/loginMethod.enum.js +8 -0
- package/build/src/enums/registrationMethod.enum.js +7 -0
- package/build/src/enums/socialLogins.enum.js +6 -0
- package/build/src/helpers/network.js +93 -0
- package/build/src/helpers/show-message/index.js +19 -0
- package/build/src/helpers/show-message/index.native.js +14 -0
- package/build/src/helpers/show-message/types.js +1 -0
- package/build/src/helpers/types.js +1 -0
- package/build/src/helpers/validation.js +12 -0
- package/build/src/hooks/internal/useAuthPackageContext.js +9 -0
- package/build/src/hooks/internal/useTimer.js +40 -0
- package/build/src/hooks/useAuthContext.js +10 -0
- package/build/src/hooks/useNavigator.js +83 -0
- package/build/src/hooks/useRequest.js +34 -0
- package/build/src/index.js +23 -0
- package/build/src/navigator/index.js +10 -0
- package/build/src/navigator/index.native.js +27 -0
- package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.js +37 -0
- package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.native.js +6 -0
- package/build/src/screens/CountryCode/components/CountryCodeDropdown/types.js +1 -0
- package/build/src/screens/CountryCode/hooks/internal/useCountryCode.js +38 -0
- package/build/src/screens/CountryCode/index.js +10 -0
- package/build/src/screens/CountryCode/index.native.js +37 -0
- package/build/src/screens/CountryCode/type.js +1 -0
- package/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +46 -0
- package/build/src/screens/CreatePassword/index.js +19 -0
- package/build/src/screens/CreatePassword/index.native.js +32 -0
- package/build/src/screens/CreatePassword/type.js +1 -0
- package/build/src/screens/EnterEmail/hooks/internal/useEnterEmail.js +77 -0
- package/build/src/screens/EnterEmail/index.js +58 -0
- package/build/src/screens/EnterEmail/index.native.js +31 -0
- package/build/src/screens/EnterEmail/types.js +1 -0
- package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.js +36 -0
- package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.js +33 -0
- package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.native.js +73 -0
- package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/types.js +1 -0
- package/build/src/screens/EnterMobile/hooks/internal/useEnterMobile.js +70 -0
- package/build/src/screens/EnterMobile/index.js +82 -0
- package/build/src/screens/EnterMobile/index.native.js +56 -0
- package/build/src/screens/EnterMobile/types.js +1 -0
- package/build/src/screens/EnterPassword/hooks/internal/useEnterPassword.js +79 -0
- package/build/src/screens/EnterPassword/index.js +68 -0
- package/build/src/screens/EnterPassword/index.native.js +41 -0
- package/build/src/screens/EnterPassword/types.js +1 -0
- package/build/src/screens/Login/components/LoginWebComponent/index.js +63 -0
- package/build/src/screens/Login/components/LoginWebComponent/index.native.js +6 -0
- package/build/src/screens/Login/index.js +10 -0
- package/build/src/screens/Login/index.native.js +6 -0
- package/build/src/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.js +85 -0
- package/build/src/screens/LoginWithEmailOTP/index.js +8 -0
- package/build/src/screens/LoginWithEmailOTP/index.native.js +10 -0
- package/build/src/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.js +72 -0
- package/build/src/screens/LoginWithMobileOTP/index.js +8 -0
- package/build/src/screens/LoginWithMobileOTP/index.native.js +10 -0
- package/build/src/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.js +71 -0
- package/build/src/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.native.js +6 -0
- package/build/src/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.js +52 -0
- package/build/src/screens/PartnerSSO/PartnerLogin/index.js +2 -0
- package/build/src/screens/PartnerSSO/PartnerLogin/types.js +1 -0
- package/build/src/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.js +207 -0
- package/build/src/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.native.js +6 -0
- package/build/src/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.js +90 -0
- package/build/src/screens/PartnerSSO/PartnerRegistration/index.js +2 -0
- package/build/src/screens/PartnerSSO/PartnerRegistration/types.js +1 -0
- package/build/src/screens/PartnerSSO/index.js +2 -0
- package/build/src/screens/Profile/components/EditMobileNumber/index.js +31 -0
- package/build/src/screens/Profile/components/EditMobileNumber/index.native.js +8 -0
- package/build/src/screens/Profile/components/EditPassword/index.js +29 -0
- package/build/src/screens/Profile/components/EditPassword/index.native.js +8 -0
- package/build/src/screens/Profile/components/EditProfile/index.js +89 -0
- package/build/src/screens/Profile/components/EditProfile/index.native.js +8 -0
- package/build/src/screens/Profile/components/OtpVerificationModal/index.js +61 -0
- package/build/src/screens/Profile/components/OtpVerificationModal/index.native.js +7 -0
- package/build/src/screens/Profile/components/ProfileWebComponent/index.js +80 -0
- package/build/src/screens/Profile/components/ProfileWebComponent/index.native.js +9 -0
- package/build/src/screens/Profile/hooks/internal/useProfile.js +185 -0
- package/build/src/screens/Profile/index.js +6 -0
- package/build/src/screens/Profile/index.native.js +6 -0
- package/build/src/screens/Profile/types.js +1 -0
- package/build/src/screens/ResetPassword/hooks/internal/useResetPassword.js +57 -0
- package/build/src/screens/ResetPassword/index.js +46 -0
- package/build/src/screens/ResetPassword/index.native.js +26 -0
- package/build/src/screens/ResetPassword/types.js +1 -0
- package/build/src/screens/SSOLogin/AuthWebView/index.js +9 -0
- package/build/src/screens/SSOLogin/AuthWebView/index.native.js +42 -0
- package/build/src/screens/SSOLogin/AuthWebView/types.js +1 -0
- package/build/src/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.js +39 -0
- package/build/src/screens/SSOLogin/AuthenticationMethods/index.js +50 -0
- package/build/src/screens/SSOLogin/AuthenticationMethods/index.native.js +59 -0
- package/build/src/screens/SSOLogin/AuthenticationMethods/types.js +1 -0
- package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.js +62 -0
- package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.js +6 -0
- package/build/src/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.js +58 -0
- package/build/src/screens/SSOLogin/SSOCallback/index.js +9 -0
- package/build/src/screens/SSOLogin/SSOCallback/index.native.js +35 -0
- package/build/src/screens/SSOLogin/SSOCallback/types.js +1 -0
- package/build/src/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.js +71 -0
- package/build/src/screens/SSOLogin/SearchOrganization/index.js +46 -0
- package/build/src/screens/SSOLogin/SearchOrganization/index.native.js +37 -0
- package/build/src/screens/SSOLogin/SearchOrganization/types.js +1 -0
- package/build/src/screens/SignUp/components/SignUpForm/index.js +215 -0
- package/build/src/screens/SignUp/components/SignUpForm/index.native.js +6 -0
- package/build/src/screens/SignUp/components/SignUpForm/type.js +1 -0
- package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +62 -0
- package/build/src/screens/SignUp/components/SignUpWebComponent/index.native.js +6 -0
- package/build/src/screens/SignUp/components/SignUpWebComponent/types.js +1 -0
- package/build/src/screens/SignUp/hooks/internal/useSignUp.js +134 -0
- package/build/src/screens/SignUp/index.js +6 -0
- package/build/src/screens/SignUp/index.native.js +188 -0
- package/build/src/screens/SignUp/types.js +1 -0
- package/build/src/screens/UserConsent/hooks/internal/useConsent.js +64 -0
- package/build/src/screens/UserConsent/index.js +84 -0
- package/build/src/screens/UserConsent/index.native.js +47 -0
- package/build/src/screens/UserConsent/types.js +1 -0
- package/build/src/screens/VerifyEmail/hooks/internal/useVerifyEmail.js +69 -0
- package/build/src/screens/VerifyEmail/index.js +8 -0
- package/build/src/screens/VerifyEmail/index.native.js +14 -0
- package/build/src/screens/VerifyEmail/types.js +1 -0
- package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.js +73 -0
- package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.js +8 -0
- package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.js +14 -0
- package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/types.js +1 -0
- package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.js +83 -0
- package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.js +8 -0
- package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.js +10 -0
- package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/types.js +1 -0
- package/build/src/screens/VerifyMobile/hooks/internal/useVerifyMobile.js +74 -0
- package/build/src/screens/VerifyMobile/index.js +8 -0
- package/build/src/screens/VerifyMobile/index.native.js +9 -0
- package/build/src/screens/VerifyMobile/types.js +1 -0
- package/build/src/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.js +74 -0
- package/build/src/screens/VerifyResetPasswordOTP/index.js +8 -0
- package/build/src/screens/VerifyResetPasswordOTP/index.native.js +14 -0
- package/build/src/screens/Welcome/SocialAuth/commonSocialAuth.js +127 -0
- package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.js +187 -0
- package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.js +13 -0
- package/build/src/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.js +115 -0
- package/build/src/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.js +72 -0
- package/build/src/screens/Welcome/components/SocialLoginModal/index.js +9 -0
- package/build/src/screens/Welcome/components/SocialLoginModal/index.native.js +21 -0
- package/build/src/screens/Welcome/components/SocialLoginModal/types.js +1 -0
- package/build/src/screens/Welcome/hooks/internal/useWelcome.js +26 -0
- package/build/src/screens/Welcome/index.js +28 -0
- package/build/src/screens/Welcome/index.native.js +78 -0
- package/build/src/types/types.js +2 -0
- package/build/types/api/auth.d.ts +11 -0
- package/build/types/api/axiosClient/index.d.ts +1 -0
- package/build/types/api/axiosClient/index.native.d.ts +1 -0
- package/build/types/components/AdvancedTransitionWrapper/index.d.ts +3 -0
- package/build/types/components/AdvancedTransitionWrapper/index.native.d.ts +5 -0
- package/build/types/components/AdvancedTransitionWrapper/types.d.ts +25 -0
- package/build/types/components/ConfirmationModal/index.d.ts +3 -0
- package/build/types/components/ConfirmationModal/index.native.d.ts +3 -0
- package/build/types/components/ConfirmationModal/types.d.ts +16 -0
- package/build/types/components/IonIcon/index.d.ts +3 -0
- package/build/types/components/IonIcon/index.native.d.ts +4 -0
- package/build/types/components/IonIcon/types.d.ts +6 -0
- package/build/types/components/LoadingAnimation/index.d.ts +6 -0
- package/build/types/components/OTPStatusLabel/index.d.ts +2 -0
- package/build/types/components/OTPStatusLabel/index.native.d.ts +3 -0
- package/build/types/components/OTPStatusLabel/types.d.ts +6 -0
- package/build/types/components/PasswordCriteria/hooks/usePasswordCriteria.d.ts +8 -0
- package/build/types/components/PasswordCriteria/index.d.ts +3 -0
- package/build/types/components/PasswordCriteria/index.native.d.ts +3 -0
- package/build/types/components/PasswordCriteria/types.d.ts +15 -0
- package/build/types/components/ScreenLayout/index.d.ts +3 -0
- package/build/types/components/ScreenLayout/index.native.d.ts +3 -0
- package/build/types/components/ScreenLayout/types.d.ts +13 -0
- package/build/types/components/SupportDetails/index.d.ts +2 -0
- package/build/types/components/SupportDetails/index.native.d.ts +2 -0
- package/build/types/components/VerifyEmailOTP/index.d.ts +3 -0
- package/build/types/components/VerifyEmailOTP/index.native.d.ts +3 -0
- package/build/types/components/VerifyEmailOTP/types.d.ts +9 -0
- package/build/types/components/VerifyMobileOTP/index.d.ts +3 -0
- package/build/types/components/VerifyMobileOTP/index.native.d.ts +3 -0
- package/build/types/components/VerifyMobileOTP/types.d.ts +9 -0
- package/build/types/constants/base-url/index.d.ts +1 -0
- package/build/types/constants/base-url/index.native.d.ts +1 -0
- package/build/types/constants/cdn-url/index.d.ts +2 -0
- package/build/types/constants/cdn-url/index.native.d.ts +3 -0
- package/build/types/constants/defaultPolicy.d.ts +9 -0
- package/build/types/constants/password-requirements.d.ts +4 -0
- package/build/types/constants/social-login-options.d.ts +3 -0
- package/build/types/contexts/AuthContext.d.ts +40 -0
- package/build/types/contexts/type.d.ts +94 -0
- package/build/types/enums/index.d.ts +3 -0
- package/build/types/enums/loginMethod.enum.d.ts +7 -0
- package/build/types/enums/registrationMethod.enum.d.ts +6 -0
- package/build/types/enums/socialLogins.enum.d.ts +5 -0
- package/build/types/helpers/network.d.ts +5 -0
- package/build/types/helpers/show-message/index.d.ts +3 -0
- package/build/types/helpers/show-message/index.native.d.ts +3 -0
- package/build/types/helpers/show-message/types.d.ts +6 -0
- package/build/types/helpers/types.d.ts +19 -0
- package/build/types/helpers/validation.d.ts +2 -0
- package/build/types/hooks/internal/useAuthPackageContext.d.ts +1 -0
- package/build/types/hooks/internal/useTimer.d.ts +3 -0
- package/build/types/hooks/useAuthContext.d.ts +2 -0
- package/build/types/hooks/useNavigator.d.ts +66 -0
- package/build/types/hooks/useRequest.d.ts +5 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/navigator/index.d.ts +2 -0
- package/build/types/navigator/index.native.d.ts +82 -0
- package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.d.ts +3 -0
- package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.native.d.ts +2 -0
- package/build/types/screens/CountryCode/components/CountryCodeDropdown/types.d.ts +17 -0
- package/build/types/screens/CountryCode/hooks/internal/useCountryCode.d.ts +12 -0
- package/build/types/screens/CountryCode/index.d.ts +2 -0
- package/build/types/screens/CountryCode/index.native.d.ts +2 -0
- package/build/types/screens/CountryCode/type.d.ts +11 -0
- package/build/types/screens/CreatePassword/hooks/internal/useCreatePassword.d.ts +37 -0
- package/build/types/screens/CreatePassword/index.d.ts +3 -0
- package/build/types/screens/CreatePassword/index.native.d.ts +4 -0
- package/build/types/screens/CreatePassword/type.d.ts +43 -0
- package/build/types/screens/EnterEmail/hooks/internal/useEnterEmail.d.ts +19 -0
- package/build/types/screens/EnterEmail/index.d.ts +3 -0
- package/build/types/screens/EnterEmail/index.native.d.ts +4 -0
- package/build/types/screens/EnterEmail/types.d.ts +13 -0
- package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.d.ts +13 -0
- package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.d.ts +3 -0
- package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.native.d.ts +3 -0
- package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/types.d.ts +28 -0
- package/build/types/screens/EnterMobile/hooks/internal/useEnterMobile.d.ts +15 -0
- package/build/types/screens/EnterMobile/index.d.ts +4 -0
- package/build/types/screens/EnterMobile/index.native.d.ts +4 -0
- package/build/types/screens/EnterMobile/types.d.ts +44 -0
- package/build/types/screens/EnterPassword/hooks/internal/useEnterPassword.d.ts +25 -0
- package/build/types/screens/EnterPassword/index.d.ts +3 -0
- package/build/types/screens/EnterPassword/index.native.d.ts +4 -0
- package/build/types/screens/EnterPassword/types.d.ts +24 -0
- package/build/types/screens/Login/components/LoginWebComponent/index.d.ts +2 -0
- package/build/types/screens/Login/components/LoginWebComponent/index.native.d.ts +2 -0
- package/build/types/screens/Login/index.d.ts +2 -0
- package/build/types/screens/Login/index.native.d.ts +2 -0
- package/build/types/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.d.ts +17 -0
- package/build/types/screens/LoginWithEmailOTP/index.d.ts +7 -0
- package/build/types/screens/LoginWithEmailOTP/index.native.d.ts +4 -0
- package/build/types/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.d.ts +11 -0
- package/build/types/screens/LoginWithMobileOTP/index.d.ts +5 -0
- package/build/types/screens/LoginWithMobileOTP/index.native.d.ts +4 -0
- package/build/types/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.d.ts +25 -0
- package/build/types/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.native.d.ts +2 -0
- package/build/types/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.d.ts +8 -0
- package/build/types/screens/PartnerSSO/PartnerLogin/index.d.ts +2 -0
- package/build/types/screens/PartnerSSO/PartnerLogin/types.d.ts +35 -0
- package/build/types/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.d.ts +24 -0
- package/build/types/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.native.d.ts +2 -0
- package/build/types/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.d.ts +8 -0
- package/build/types/screens/PartnerSSO/PartnerRegistration/index.d.ts +2 -0
- package/build/types/screens/PartnerSSO/PartnerRegistration/types.d.ts +63 -0
- package/build/types/screens/PartnerSSO/index.d.ts +2 -0
- package/build/types/screens/Profile/components/EditMobileNumber/index.d.ts +6 -0
- package/build/types/screens/Profile/components/EditMobileNumber/index.native.d.ts +3 -0
- package/build/types/screens/Profile/components/EditPassword/index.d.ts +6 -0
- package/build/types/screens/Profile/components/EditPassword/index.native.d.ts +3 -0
- package/build/types/screens/Profile/components/EditProfile/index.d.ts +6 -0
- package/build/types/screens/Profile/components/EditProfile/index.native.d.ts +3 -0
- package/build/types/screens/Profile/components/OtpVerificationModal/index.d.ts +4 -0
- package/build/types/screens/Profile/components/OtpVerificationModal/index.native.d.ts +3 -0
- package/build/types/screens/Profile/components/ProfileWebComponent/index.d.ts +4 -0
- package/build/types/screens/Profile/components/ProfileWebComponent/index.native.d.ts +3 -0
- package/build/types/screens/Profile/hooks/internal/useProfile.d.ts +26 -0
- package/build/types/screens/Profile/index.d.ts +7 -0
- package/build/types/screens/Profile/index.native.d.ts +7 -0
- package/build/types/screens/Profile/types.d.ts +53 -0
- package/build/types/screens/ResetPassword/hooks/internal/useResetPassword.d.ts +29 -0
- package/build/types/screens/ResetPassword/index.d.ts +3 -0
- package/build/types/screens/ResetPassword/index.native.d.ts +4 -0
- package/build/types/screens/ResetPassword/types.d.ts +11 -0
- package/build/types/screens/SSOLogin/AuthWebView/index.d.ts +2 -0
- package/build/types/screens/SSOLogin/AuthWebView/index.native.d.ts +4 -0
- package/build/types/screens/SSOLogin/AuthWebView/types.d.ts +8 -0
- package/build/types/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.d.ts +9 -0
- package/build/types/screens/SSOLogin/AuthenticationMethods/index.d.ts +3 -0
- package/build/types/screens/SSOLogin/AuthenticationMethods/index.native.d.ts +4 -0
- package/build/types/screens/SSOLogin/AuthenticationMethods/types.d.ts +14 -0
- package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.d.ts +6 -0
- package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.d.ts +2 -0
- package/build/types/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.d.ts +15 -0
- package/build/types/screens/SSOLogin/SSOCallback/index.d.ts +2 -0
- package/build/types/screens/SSOLogin/SSOCallback/index.native.d.ts +4 -0
- package/build/types/screens/SSOLogin/SSOCallback/types.d.ts +14 -0
- package/build/types/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.d.ts +18 -0
- package/build/types/screens/SSOLogin/SearchOrganization/index.d.ts +3 -0
- package/build/types/screens/SSOLogin/SearchOrganization/index.native.d.ts +4 -0
- package/build/types/screens/SSOLogin/SearchOrganization/types.d.ts +13 -0
- package/build/types/screens/SignUp/components/SignUpForm/index.d.ts +3 -0
- package/build/types/screens/SignUp/components/SignUpForm/index.native.d.ts +2 -0
- package/build/types/screens/SignUp/components/SignUpForm/type.d.ts +6 -0
- package/build/types/screens/SignUp/components/SignUpWebComponent/index.d.ts +2 -0
- package/build/types/screens/SignUp/components/SignUpWebComponent/index.native.d.ts +2 -0
- package/build/types/screens/SignUp/components/SignUpWebComponent/types.d.ts +9 -0
- package/build/types/screens/SignUp/hooks/internal/useSignUp.d.ts +48 -0
- package/build/types/screens/SignUp/index.d.ts +2 -0
- package/build/types/screens/SignUp/index.native.d.ts +4 -0
- package/build/types/screens/SignUp/types.d.ts +40 -0
- package/build/types/screens/UserConsent/hooks/internal/useConsent.d.ts +10 -0
- package/build/types/screens/UserConsent/index.d.ts +3 -0
- package/build/types/screens/UserConsent/index.native.d.ts +4 -0
- package/build/types/screens/UserConsent/types.d.ts +33 -0
- package/build/types/screens/VerifyEmail/hooks/internal/useVerifyEmail.d.ts +19 -0
- package/build/types/screens/VerifyEmail/index.d.ts +3 -0
- package/build/types/screens/VerifyEmail/index.native.d.ts +4 -0
- package/build/types/screens/VerifyEmail/types.d.ts +8 -0
- package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.d.ts +15 -0
- package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.d.ts +3 -0
- package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.d.ts +4 -0
- package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/types.d.ts +14 -0
- package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.d.ts +17 -0
- package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.d.ts +3 -0
- package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.d.ts +4 -0
- package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/types.d.ts +5 -0
- package/build/types/screens/VerifyMobile/hooks/internal/useVerifyMobile.d.ts +14 -0
- package/build/types/screens/VerifyMobile/index.d.ts +3 -0
- package/build/types/screens/VerifyMobile/index.native.d.ts +4 -0
- package/build/types/screens/VerifyMobile/types.d.ts +5 -0
- package/build/types/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.d.ts +19 -0
- package/build/types/screens/VerifyResetPasswordOTP/index.d.ts +7 -0
- package/build/types/screens/VerifyResetPasswordOTP/index.native.d.ts +4 -0
- package/build/types/screens/Welcome/SocialAuth/commonSocialAuth.d.ts +50 -0
- package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.d.ts +7 -0
- package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.d.ts +7 -0
- package/build/types/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.d.ts +5 -0
- package/build/types/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.d.ts +4 -0
- package/build/types/screens/Welcome/components/SocialLoginModal/index.d.ts +3 -0
- package/build/types/screens/Welcome/components/SocialLoginModal/index.native.d.ts +3 -0
- package/build/types/screens/Welcome/components/SocialLoginModal/types.d.ts +8 -0
- package/build/types/screens/Welcome/hooks/internal/useWelcome.d.ts +22 -0
- package/build/types/screens/Welcome/index.d.ts +4 -0
- package/build/types/screens/Welcome/index.native.d.ts +4 -0
- package/build/types/types/types.d.ts +115 -0
- package/package.json +3 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Flex, Form, ResponsiveModal, TextInput, Typography, useForm } from '@truworth/twc-web-design';
|
|
3
|
+
import { ScreenLayout } from "../../components/ScreenLayout";
|
|
4
|
+
import { useEnterMobile } from "./hooks/internal/useEnterMobile";
|
|
5
|
+
import { CountryCodeDropdown } from '../CountryCode/components/CountryCodeDropdown';
|
|
6
|
+
import { useNavigator } from '../../hooks/useNavigator';
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import { ExistingAccountsSheet } from './components/ExistingAccountsSheet';
|
|
9
|
+
import LoginWithMobileOTP from '../LoginWithMobileOTP';
|
|
10
|
+
import VerifyLinkPrimaryAccountEmailOTP from '../VerifyLinkPrimaryAccountEmailOTP';
|
|
11
|
+
import VerifyLinkPrimaryAccountMobileOTP from '../VerifyLinkPrimaryAccountMobileOTP';
|
|
12
|
+
import { RegistrationMethod } from '../../enums';
|
|
13
|
+
const EnterMobile = ({ onPressBack }) => {
|
|
14
|
+
const [showLoginWithMobileOTPModal, setShowLoginWithMobileOTPModal] = useState(false);
|
|
15
|
+
const [showVerifyLinkPrimaryEmailModal, setShowVerifyLinkPrimaryEmailModal] = useState(false);
|
|
16
|
+
const [showVerifyLinkPrimaryMobileModal, setShowVerifyLinkPrimaryMobileModal] = useState(false);
|
|
17
|
+
const [email, setEmail] = useState('');
|
|
18
|
+
const [memberId, setMemberId] = useState('');
|
|
19
|
+
const [sessionToken, setSessionToken] = useState('');
|
|
20
|
+
const [selectedCountry, setSelectedCountry] = useState({
|
|
21
|
+
countryCode: "in",
|
|
22
|
+
phoneCode: "91",
|
|
23
|
+
name: "INDIA",
|
|
24
|
+
});
|
|
25
|
+
const form = useForm();
|
|
26
|
+
const navigator = useNavigator();
|
|
27
|
+
const { loading, phone, isValidPhone, countryCode, setCountryCode, existingAccounts, showExistingAccountsSheet, setShowExistingAccountsSheet, handleValidatePhone, handleEnterMobile, } = useEnterMobile();
|
|
28
|
+
const handleSubmit = () => {
|
|
29
|
+
handleValidatePhone({
|
|
30
|
+
onValidate: ({ mobileExist, memberId }) => {
|
|
31
|
+
if (mobileExist && memberId) {
|
|
32
|
+
setMemberId(memberId);
|
|
33
|
+
setShowLoginWithMobileOTPModal(true);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
navigator.pushAbsolute('/registration', {
|
|
37
|
+
query: { phone, registrationMethod: RegistrationMethod.MOBILE }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
return (_jsxs(ScreenLayout, { title: "Enter Your Mobile Number", buttonProps: {
|
|
44
|
+
loading,
|
|
45
|
+
label: 'Continue',
|
|
46
|
+
onClick: handleSubmit,
|
|
47
|
+
disabled: !isValidPhone,
|
|
48
|
+
}, onPressBack: onPressBack, children: [_jsx(Form, { className: "w-full", form: form, onSubmit: handleSubmit, children: _jsx(Form.Item, { label: "Mobile Number", className: "my-6", rules: [
|
|
49
|
+
{
|
|
50
|
+
required: true,
|
|
51
|
+
message: 'Please enter your mobile number'
|
|
52
|
+
}
|
|
53
|
+
], ...form.register("phone", {
|
|
54
|
+
onChange: (e) => handleEnterMobile(e.target.value)
|
|
55
|
+
}), 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) => {
|
|
56
|
+
setCountryCode(country.phoneCode);
|
|
57
|
+
setSelectedCountry(country);
|
|
58
|
+
} }) }) }) }) }), showLoginWithMobileOTPModal &&
|
|
59
|
+
_jsx(LoginWithMobileOTPModal, { memberId: memberId, phone: phone, show: showLoginWithMobileOTPModal, hide: () => setShowLoginWithMobileOTPModal(false) }), showExistingAccountsSheet &&
|
|
60
|
+
_jsx(ExistingAccountsSheet, { phone: phone, visible: showExistingAccountsSheet, existingAccounts: existingAccounts, onInitiateAccountLinking: ({ sessionToken, email }) => {
|
|
61
|
+
setSessionToken(sessionToken);
|
|
62
|
+
setEmail(email);
|
|
63
|
+
setShowExistingAccountsSheet(false);
|
|
64
|
+
setShowVerifyLinkPrimaryEmailModal(true);
|
|
65
|
+
}, hide: () => setShowExistingAccountsSheet(false) }), showVerifyLinkPrimaryEmailModal &&
|
|
66
|
+
_jsx(VerifyLinkPrimaryAccountEmailOTPModal, { email: email, sessionToken: sessionToken, show: showVerifyLinkPrimaryEmailModal, hide: () => setShowVerifyLinkPrimaryEmailModal(false), onVerifiedOTP: ({ sessionToken }) => {
|
|
67
|
+
setSessionToken(sessionToken);
|
|
68
|
+
setShowVerifyLinkPrimaryEmailModal(false);
|
|
69
|
+
setShowVerifyLinkPrimaryMobileModal(true);
|
|
70
|
+
} }), showVerifyLinkPrimaryMobileModal &&
|
|
71
|
+
_jsx(VerifyLinkPrimaryAccountMobileOTPModal, { phone: phone, sessionToken: sessionToken, show: showVerifyLinkPrimaryMobileModal, hide: () => setShowVerifyLinkPrimaryMobileModal(false) })] }));
|
|
72
|
+
};
|
|
73
|
+
const VerifyLinkPrimaryAccountEmailOTPModal = ({ show, hide, email, sessionToken, onVerifiedOTP }) => {
|
|
74
|
+
return (_jsx(ResponsiveModal, { title: "Verify Email", open: show, onClose: hide, maskClosable: false, showCloseButton: false, size: 'sm', children: _jsx(VerifyLinkPrimaryAccountEmailOTP, { email: email, sessionToken: sessionToken, onVerifiedOTP: onVerifiedOTP }) }));
|
|
75
|
+
};
|
|
76
|
+
const VerifyLinkPrimaryAccountMobileOTPModal = ({ show, hide, phone, sessionToken }) => {
|
|
77
|
+
return (_jsx(ResponsiveModal, { title: "Verify Mobile Number", open: show, onClose: hide, maskClosable: false, showCloseButton: false, size: 'sm', children: _jsx(VerifyLinkPrimaryAccountMobileOTP, { phone: phone, sessionToken: sessionToken }) }));
|
|
78
|
+
};
|
|
79
|
+
const LoginWithMobileOTPModal = ({ show, hide, memberId, phone }) => {
|
|
80
|
+
return (_jsx(ResponsiveModal, { open: show, onClose: hide, title: _jsx(Typography, { type: "heading", size: "h6", className: "text-center mb-0", children: "Verify Mobile Number" }), showCloseButton: false, maskClosable: false, size: 'sm', children: _jsx(LoginWithMobileOTP, { phone: phone, memberId: memberId }) }));
|
|
81
|
+
};
|
|
82
|
+
export default EnterMobile;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRoute } from '@react-navigation/native';
|
|
3
|
+
import { Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
|
4
|
+
import { Colors } from '@truworth/twc-rn-common';
|
|
5
|
+
import { Layout } from '@ui-kitten/components';
|
|
6
|
+
import { useEffect } from 'react';
|
|
7
|
+
import IonIcons from 'react-native-vector-icons/Ionicons';
|
|
8
|
+
import { ScreenLayout } from '../../components/ScreenLayout';
|
|
9
|
+
import { useEnterMobile } from './hooks/internal/useEnterMobile';
|
|
10
|
+
import { ExistingAccountsSheet } from './components/ExistingAccountsSheet/index.native';
|
|
11
|
+
const { gray, primary } = Colors;
|
|
12
|
+
const EnterMobile = ({ navigation }) => {
|
|
13
|
+
const route = useRoute();
|
|
14
|
+
const { loading, phone, isValidPhone, countryCode, setCountryCode, existingAccounts, showExistingAccountsSheet, setShowExistingAccountsSheet, handleValidatePhone, handleEnterMobile, handleClearPhoneInput } = useEnterMobile();
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (route.params?.countryCode) {
|
|
17
|
+
setCountryCode(route.params?.countryCode);
|
|
18
|
+
}
|
|
19
|
+
}, [route.params?.countryCode]);
|
|
20
|
+
const changeCountryCode = () => {
|
|
21
|
+
navigation.navigate('CountryCode', { prevRoute: 'EnterMobile' });
|
|
22
|
+
};
|
|
23
|
+
const handleSubmit = () => {
|
|
24
|
+
Keyboard.dismiss();
|
|
25
|
+
handleValidatePhone({
|
|
26
|
+
onValidate: ({ mobileExist, memberId }) => {
|
|
27
|
+
if (mobileExist && memberId) {
|
|
28
|
+
navigation.navigate('LoginWithMobileOTP', {
|
|
29
|
+
phone,
|
|
30
|
+
memberId
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
navigation.navigate('SignUp', { phone });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
return (_jsxs(Layout, { style: { flex: 1, backgroundColor: '#FFFFFF' }, children: [_jsx(ScreenLayout, { title: "Enter Your Mobile Number", buttonProps: {
|
|
40
|
+
loading,
|
|
41
|
+
label: 'Continue',
|
|
42
|
+
onPress: handleSubmit,
|
|
43
|
+
disabled: !isValidPhone,
|
|
44
|
+
}, children: _jsxs(View, { style: {
|
|
45
|
+
flexDirection: 'row', alignItems: 'center',
|
|
46
|
+
borderWidth: 1, borderRadius: 8,
|
|
47
|
+
paddingHorizontal: 12, height: 56,
|
|
48
|
+
backgroundColor: primary.white, marginTop: 4,
|
|
49
|
+
}, children: [_jsxs(TouchableOpacity, { activeOpacity: 0.8, onPress: changeCountryCode, style: { flexDirection: 'row', alignItems: 'center' }, children: [_jsx(Text, { style: { fontSize: 14, color: primary.black, fontWeight: '500' }, children: `+${countryCode}` }), _jsx(IonIcons, { name: 'caret-down', size: 14, color: gray.gray_900 })] }), _jsx(TextInput, { style: {
|
|
50
|
+
flex: 1, fontSize: 14, fontWeight: '500',
|
|
51
|
+
color: primary.black, marginLeft: 2,
|
|
52
|
+
}, onChangeText: text => handleEnterMobile(text), value: phone, keyboardType: "numeric", maxLength: countryCode === '91' ? 10 : 14, autoFocus: true }), phone.length > 0 &&
|
|
53
|
+
_jsx(TouchableOpacity, { activeOpacity: 0.8, onPress: handleClearPhoneInput, children: _jsx(IonIcons, { name: 'close', size: 24, color: gray.gray_900 }) })] }) }), showExistingAccountsSheet &&
|
|
54
|
+
_jsx(ExistingAccountsSheet, { phone: phone, visible: showExistingAccountsSheet, existingAccounts: existingAccounts, hide: () => setShowExistingAccountsSheet(false) })] }));
|
|
55
|
+
};
|
|
56
|
+
export default EnterMobile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useState, useCallback, useMemo } from "react";
|
|
2
|
+
import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
|
|
3
|
+
import { axiosClient } from "../../../../api/axiosClient";
|
|
4
|
+
import { showMessage } from "../../../../helpers/show-message";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* Hook for managing Enter Password screen logic and authentication integration.
|
|
8
|
+
*/
|
|
9
|
+
const useEnterPassword = () => {
|
|
10
|
+
const [password, setPassword] = useState("");
|
|
11
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
12
|
+
const [invalidPassword, setInvalidPassword] = useState(false);
|
|
13
|
+
const [loading, setLoading] = useState(false);
|
|
14
|
+
const { onTokenChange, onLogin, appConfig } = useAuthPackageContext();
|
|
15
|
+
const togglePasswordVisibility = useCallback(() => {
|
|
16
|
+
setIsPasswordVisible((prev) => !prev);
|
|
17
|
+
}, []);
|
|
18
|
+
const handlePasswordChange = useCallback((value) => {
|
|
19
|
+
setInvalidPassword(false);
|
|
20
|
+
setPassword(value);
|
|
21
|
+
}, []);
|
|
22
|
+
const handleSubmit = useCallback(async ({ email, source, verifyEmailOTP }) => {
|
|
23
|
+
setLoading(true);
|
|
24
|
+
try {
|
|
25
|
+
const response = await axiosClient.post("/auth/login/v2", {
|
|
26
|
+
email,
|
|
27
|
+
password,
|
|
28
|
+
source,
|
|
29
|
+
});
|
|
30
|
+
// Check if MFA is enabled
|
|
31
|
+
if (response.data.mfaEnabled && response.data.sessionToken) {
|
|
32
|
+
// Navigate to LoginWithEmailOTP screen with sessionToken
|
|
33
|
+
if (verifyEmailOTP) {
|
|
34
|
+
verifyEmailOTP({
|
|
35
|
+
mfaEnabled: response.data.mfaEnabled,
|
|
36
|
+
sessionToken: response.data.sessionToken
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
setLoading(false);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Normal login flow (no MFA)
|
|
43
|
+
if (response.data.token) {
|
|
44
|
+
onTokenChange(response.data.token);
|
|
45
|
+
onLogin(response.data);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const errorMessage = error?.response?.data?.errors?.[0]?.message;
|
|
50
|
+
if (error?.response?.status === 400) {
|
|
51
|
+
setInvalidPassword(true);
|
|
52
|
+
if (source === 'web') {
|
|
53
|
+
showMessage({ message: errorMessage ?? 'Email and password do not match!' });
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
showMessage({ message: errorMessage ?? 'Something went wrong. Please try again.' });
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
setLoading(false);
|
|
61
|
+
}
|
|
62
|
+
}, [password, onTokenChange, onLogin]);
|
|
63
|
+
const isDisabled = useMemo(() => {
|
|
64
|
+
return password?.length === 0 || loading;
|
|
65
|
+
}, [password, loading]);
|
|
66
|
+
return {
|
|
67
|
+
loading,
|
|
68
|
+
password,
|
|
69
|
+
setPassword,
|
|
70
|
+
isPasswordVisible,
|
|
71
|
+
togglePasswordVisibility,
|
|
72
|
+
handleSubmit,
|
|
73
|
+
isDisabled,
|
|
74
|
+
handlePasswordChange,
|
|
75
|
+
appName: appConfig.appName,
|
|
76
|
+
invalidPassword
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export { useEnterPassword };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button, Flex, Form, PasswordInput, ResponsiveModal, Typography, useForm } from '@truworth/twc-web-design';
|
|
4
|
+
import { ScreenLayout } from "../../components/ScreenLayout";
|
|
5
|
+
import { useEnterPassword } from './hooks/internal/useEnterPassword';
|
|
6
|
+
import { SupportDetails } from '../../components/SupportDetails';
|
|
7
|
+
import LoginWithEmailOTP from '../LoginWithEmailOTP';
|
|
8
|
+
import VerifyResetPasswordOTP from '../VerifyResetPasswordOTP';
|
|
9
|
+
const EnterPassword = ({ email, onPressBack, onVerifiedResetPasswordOTP }) => {
|
|
10
|
+
const [showResetPasswordOTPModal, setShowResetPasswordOTPModal] = useState(false);
|
|
11
|
+
const [showLoginWithEmailOTPModal, setShowLoginWithEmailOTPModal] = useState(false);
|
|
12
|
+
const [mfaSessionToken, setMfaSessionToken] = useState(undefined);
|
|
13
|
+
const [mfaEnabled, setMfaEnabled] = useState(false);
|
|
14
|
+
const { loading, password, handlePasswordChange, handleSubmit, appName } = useEnterPassword();
|
|
15
|
+
const form = useForm({ defaultValues: { password } });
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsxs(ScreenLayout, { title: `Hi, Welcome To ${appName}!`, subTitle: email, buttonProps: {
|
|
17
|
+
loading,
|
|
18
|
+
label: 'Continue',
|
|
19
|
+
onClick: () => {
|
|
20
|
+
if (email)
|
|
21
|
+
handleSubmit({
|
|
22
|
+
email,
|
|
23
|
+
source: 'web',
|
|
24
|
+
verifyEmailOTP: ({ mfaEnabled, sessionToken }) => {
|
|
25
|
+
setMfaSessionToken(sessionToken);
|
|
26
|
+
setMfaEnabled(mfaEnabled);
|
|
27
|
+
setShowLoginWithEmailOTPModal(true);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
disabled: !password || !email || loading,
|
|
32
|
+
}, onPressBack: onPressBack, children: [_jsx(Form, { className: "w-full", form: form, onSubmit: () => {
|
|
33
|
+
if (email)
|
|
34
|
+
handleSubmit({
|
|
35
|
+
email,
|
|
36
|
+
source: 'web',
|
|
37
|
+
verifyEmailOTP: ({ mfaEnabled, sessionToken }) => {
|
|
38
|
+
setMfaSessionToken(sessionToken);
|
|
39
|
+
setMfaEnabled(mfaEnabled);
|
|
40
|
+
setShowLoginWithEmailOTPModal(true);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}, children: _jsx(Form.Item, { name: "password", label: "Password", children: _jsx(PasswordInput, { placeholder: "Enter your password", value: password, showStrengthIndicator: false, className: `border rounded-md px-3 py-2 border-gray-300`, ...form.register('password', {
|
|
44
|
+
onChange: (e) => {
|
|
45
|
+
handlePasswordChange(e.target.value);
|
|
46
|
+
}
|
|
47
|
+
}) }) }) }), _jsx(Button, { type: "button", size: 'small', variant: 'link', label: "Forgot Password?", className: "px-0 h-auto ml-auto block mt-4", onClick: () => setShowResetPasswordOTPModal(true) })] }), _jsxs(Flex, { align: "center", className: "mt-6 mb-6", children: [_jsx(Flex, { className: "flex-1 border-t border-gray-300" }), _jsx(Typography, { type: 'body', size: 'small', className: "text-gray-500 px-4", children: "OR" }), _jsx(Flex, { className: "flex-1 border-t border-gray-300" })] }), _jsx(Button, { label: 'Sign In with Email OTP', variant: 'secondary', className: 'flex-none', isFullWidth: true, type: "button", onClick: () => {
|
|
48
|
+
setMfaSessionToken(undefined);
|
|
49
|
+
setMfaEnabled(false);
|
|
50
|
+
setShowLoginWithEmailOTPModal(true);
|
|
51
|
+
} }), _jsx(SupportDetails, {}), showResetPasswordOTPModal &&
|
|
52
|
+
_jsx(VerifyResetPasswordOTPModal, { email: email, show: showResetPasswordOTPModal, hide: () => setShowResetPasswordOTPModal(false), onVerifiedOTP: (sessionToken) => {
|
|
53
|
+
setShowResetPasswordOTPModal(false);
|
|
54
|
+
onVerifiedResetPasswordOTP(sessionToken);
|
|
55
|
+
} }), showLoginWithEmailOTPModal &&
|
|
56
|
+
_jsx(LoginWithEmailOTPModal, { email: email, password: password, sessionToken: mfaSessionToken, mfaEnabled: mfaEnabled, show: showLoginWithEmailOTPModal, hide: () => {
|
|
57
|
+
setShowLoginWithEmailOTPModal(false);
|
|
58
|
+
setMfaSessionToken(undefined);
|
|
59
|
+
setMfaEnabled(false);
|
|
60
|
+
} })] }));
|
|
61
|
+
};
|
|
62
|
+
const LoginWithEmailOTPModal = ({ show, hide, email, password, sessionToken, mfaEnabled }) => {
|
|
63
|
+
return (_jsx(ResponsiveModal, { open: show, onClose: hide, title: _jsx(Typography, { type: "heading", size: "h6", className: "text-center mb-0", children: "Verify Your Email" }), showCloseButton: false, maskClosable: false, size: 'sm', children: _jsx(LoginWithEmailOTP, { email: email, password: password, sessionToken: sessionToken, mfaEnabled: mfaEnabled }) }));
|
|
64
|
+
};
|
|
65
|
+
const VerifyResetPasswordOTPModal = ({ show, hide, email, onVerifiedOTP }) => {
|
|
66
|
+
return (_jsx(ResponsiveModal, { title: "Reset Your Password", open: show, onClose: hide, maskClosable: false, showCloseButton: false, size: 'sm', children: _jsx(VerifyResetPasswordOTP, { email: email, onVerifiedOTP: onVerifiedOTP }) }));
|
|
67
|
+
};
|
|
68
|
+
export default EnterPassword;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View, Text, Platform, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { RoundedButton, TextInputField, Colors } from '@truworth/twc-rn-common';
|
|
4
|
+
import { Layout } from '@ui-kitten/components';
|
|
5
|
+
import { ScreenLayout } from '../../components/ScreenLayout/index.native';
|
|
6
|
+
import { useEnterPassword } from './hooks/internal/useEnterPassword';
|
|
7
|
+
const { primary } = Colors;
|
|
8
|
+
const EnterPassword = ({ navigation, route }) => {
|
|
9
|
+
const { email } = route.params;
|
|
10
|
+
const { loading, password, isPasswordVisible, togglePasswordVisibility, handlePasswordChange, isDisabled, handleSubmit, invalidPassword } = useEnterPassword();
|
|
11
|
+
return (_jsxs(Layout, { style: { flex: 1, backgroundColor: primary.white }, children: [_jsxs(ScreenLayout, { title: "Enter Your Password", buttonProps: {
|
|
12
|
+
loading,
|
|
13
|
+
label: 'Continue',
|
|
14
|
+
onPress: () => {
|
|
15
|
+
if (email)
|
|
16
|
+
handleSubmit({
|
|
17
|
+
email,
|
|
18
|
+
source: Platform.OS,
|
|
19
|
+
verifyEmailOTP: ({ mfaEnabled, sessionToken }) => {
|
|
20
|
+
navigation.navigate('LoginWithEmailOTP', { email, password, mfaEnabled, sessionToken });
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
disabled: isDisabled,
|
|
25
|
+
}, children: [_jsx(View, { style: { position: 'relative' }, children: _jsx(TextInputField, { placeholder: 'Enter password...', onChangeValue: handlePasswordChange, secureTextEntry: !isPasswordVisible, value: password, rightIcon2: isPasswordVisible ? 'eye-outline' : 'eye-off-outline', onPressRightIcon2: () => togglePasswordVisibility(), error: {
|
|
26
|
+
show: invalidPassword,
|
|
27
|
+
message: 'Email and password do not match!'
|
|
28
|
+
}, autoFocus: true }) }), _jsx(TouchableOpacity, { activeOpacity: 0.8, style: { marginTop: 10, alignSelf: 'flex-end' }, onPress: () => navigation.navigate('VerifyResetPasswordOTP', { email }), children: _jsx(Text, { style: {
|
|
29
|
+
fontSize: 12, fontWeight: '600',
|
|
30
|
+
color: primary.primary_main, lineHeight: 20,
|
|
31
|
+
}, children: "Forgot Password?" }) })] }), _jsxs(View, { style: { paddingHorizontal: 16 }, children: [_jsxs(View, { style: {
|
|
32
|
+
flexDirection: 'row', justifyContent: 'center',
|
|
33
|
+
alignItems: 'center', marginBottom: 14, marginTop: 14,
|
|
34
|
+
}, children: [_jsx(View, { style: { width: 12, height: 1, backgroundColor: '#7F7F7F' } }), _jsx(Text, { style: {
|
|
35
|
+
fontSize: 12, fontWeight: '600', color: '#7F7F7F',
|
|
36
|
+
lineHeight: 20, textAlign: 'center',
|
|
37
|
+
marginHorizontal: 6,
|
|
38
|
+
}, children: "OR" }), _jsx(View, { style: { width: 12, height: 1, backgroundColor: '#7F7F7F' } })] }), email &&
|
|
39
|
+
_jsx(RoundedButton, { type: "text", size: "medium", label: "Sign In with Email OTP", onPress: () => navigation.navigate('LoginWithEmailOTP', { email }) })] })] }));
|
|
40
|
+
};
|
|
41
|
+
export default EnterPassword;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Flex } from '@truworth/twc-web-design';
|
|
4
|
+
import { AdvancedTransitionWrapper } from '../../../../components/AdvancedTransitionWrapper';
|
|
5
|
+
import { useAuthPackageContext } from '../../../../hooks/internal/useAuthPackageContext';
|
|
6
|
+
import { useNavigator } from '../../../../hooks/useNavigator';
|
|
7
|
+
import EnterEmail from '../../../EnterEmail/index';
|
|
8
|
+
import EnterPassword from '../../../EnterPassword/index';
|
|
9
|
+
import ResetPassword from '../../../ResetPassword/index';
|
|
10
|
+
import SSOSearchOrganization from '../../../SSOLogin/SearchOrganization/index';
|
|
11
|
+
import SSOAuthenticationMethods from '../../../SSOLogin/AuthenticationMethods/index';
|
|
12
|
+
import EnterMobile from '../../../../screens/EnterMobile/index';
|
|
13
|
+
const LoginWebComponent = () => {
|
|
14
|
+
const [email, setEmail] = useState('');
|
|
15
|
+
const [loginState, setLoginState] = useState('EnterEmail');
|
|
16
|
+
const [sessionToken, setSessionToken] = useState('');
|
|
17
|
+
const [selectedClient, setSelectedClient] = useState(null);
|
|
18
|
+
const { LogoComponent } = useAuthPackageContext();
|
|
19
|
+
const navigator = useNavigator();
|
|
20
|
+
const onRedirectToPassword = (email) => {
|
|
21
|
+
setEmail(email);
|
|
22
|
+
setLoginState('EnterPassword');
|
|
23
|
+
};
|
|
24
|
+
const onRedirectToSignUp = (email) => {
|
|
25
|
+
navigator.pushAbsolute('/registration', {
|
|
26
|
+
query: { email, registrationMethod: 'email' }
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const renderStep = () => {
|
|
30
|
+
switch (loginState) {
|
|
31
|
+
case 'EnterEmail':
|
|
32
|
+
return (_jsx(EnterEmail, { onContinue: (params) => {
|
|
33
|
+
if (params.emailExist) {
|
|
34
|
+
onRedirectToPassword(params.email);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
onRedirectToSignUp(params.email);
|
|
38
|
+
}
|
|
39
|
+
}, onPressSignInWithSSO: () => setLoginState('SSOSearchOrganization') }));
|
|
40
|
+
case 'EnterPassword':
|
|
41
|
+
return (_jsx(EnterPassword, { email: email, onPressBack: () => setLoginState('EnterEmail'), onVerifiedResetPasswordOTP: ({ sessionToken }) => {
|
|
42
|
+
setSessionToken(sessionToken);
|
|
43
|
+
setLoginState('ResetPassword');
|
|
44
|
+
} }));
|
|
45
|
+
case 'ResetPassword':
|
|
46
|
+
return (_jsx(ResetPassword, { email: email, sessionToken: sessionToken, onContinue: () => setLoginState('EnterEmail'), onPressBack: () => setLoginState('EnterPassword') }));
|
|
47
|
+
case 'SSOSearchOrganization':
|
|
48
|
+
return (_jsx(SSOSearchOrganization, { onPressBack: () => setLoginState('EnterEmail'), onContinue: (client) => {
|
|
49
|
+
setSelectedClient(client);
|
|
50
|
+
setLoginState('SSOAuthenticationMethods');
|
|
51
|
+
} }));
|
|
52
|
+
case 'SSOAuthenticationMethods':
|
|
53
|
+
return selectedClient && (_jsx(SSOAuthenticationMethods, { client: selectedClient, onPressBack: () => setLoginState('EnterEmail'), handleMobileLogin: () => setLoginState('EnterMobile') }));
|
|
54
|
+
case 'EnterMobile':
|
|
55
|
+
return (_jsx(EnterMobile, { onPressBack: () => setLoginState('SSOAuthenticationMethods') }));
|
|
56
|
+
default:
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return (_jsx(AdvancedTransitionWrapper, { type: 'slide', duration: 0.5, children: _jsxs(Flex, { direction: 'column', justify: 'center', className: `lg:w-[70%] lg:h-screen mx-auto h-full my-10`, children: [React.isValidElement(LogoComponent)
|
|
61
|
+
&& LogoComponent, renderStep()] }) }));
|
|
62
|
+
};
|
|
63
|
+
export { LoginWebComponent };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { showMessage } from "../../../../helpers/show-message";
|
|
3
|
+
import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
|
|
4
|
+
import { axiosClient } from "../../../../api/axiosClient";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* Hook for handling Email OTP Login flow.
|
|
8
|
+
*/
|
|
9
|
+
const useLoginWithEmailOTP = ({ email, password, source, sessionToken, mfaEnabled }) => {
|
|
10
|
+
const [resendOTPCounter, setResendOTPCounter] = useState(0);
|
|
11
|
+
const [status, setStatus] = useState("idle");
|
|
12
|
+
const sessionTokenRef = useRef(sessionToken || "");
|
|
13
|
+
const { onLogin, onTokenChange } = useAuthPackageContext();
|
|
14
|
+
/**
|
|
15
|
+
* Sends an OTP to the provided email.
|
|
16
|
+
*/
|
|
17
|
+
const sendOtp = useCallback(() => {
|
|
18
|
+
setStatus("loading");
|
|
19
|
+
const payload = { email, source };
|
|
20
|
+
if (password && mfaEnabled) {
|
|
21
|
+
payload.password = password;
|
|
22
|
+
}
|
|
23
|
+
axiosClient({
|
|
24
|
+
url: mfaEnabled ? '/auth/login/v2' : '/auth/login/email',
|
|
25
|
+
method: 'POST',
|
|
26
|
+
data: payload
|
|
27
|
+
}).then((res) => {
|
|
28
|
+
setResendOTPCounter(prevCounter => prevCounter + 1);
|
|
29
|
+
sessionTokenRef.current = res.data.sessionToken;
|
|
30
|
+
}).catch((error) => {
|
|
31
|
+
console.log('Failed to send OTP:', error);
|
|
32
|
+
const message = error?.response?.data?.errors?.[0]?.message || "Failed to send OTP. Please try again.";
|
|
33
|
+
showMessage({ message });
|
|
34
|
+
}).finally(() => setStatus("idle"));
|
|
35
|
+
}, [email, source, password, mfaEnabled]);
|
|
36
|
+
/**
|
|
37
|
+
* Verifies the entered OTP and logs the user in.
|
|
38
|
+
*/
|
|
39
|
+
const verifyOtp = useCallback((otp) => {
|
|
40
|
+
setStatus("loading");
|
|
41
|
+
axiosClient({
|
|
42
|
+
url: '/auth/login/email/verify-otp',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
data: { otp, sessionToken: sessionTokenRef.current },
|
|
45
|
+
}).then((res) => {
|
|
46
|
+
setStatus('valid');
|
|
47
|
+
const { token, member } = res.data;
|
|
48
|
+
onTokenChange(token);
|
|
49
|
+
onLogin({ token, member });
|
|
50
|
+
}).catch((error) => {
|
|
51
|
+
const errorCode = error?.response?.status;
|
|
52
|
+
const isInvalidOtp = errorCode === 400;
|
|
53
|
+
const message = error?.response?.data?.errors?.[0]?.message ||
|
|
54
|
+
(isInvalidOtp
|
|
55
|
+
? "Invalid OTP. Please try again."
|
|
56
|
+
: "Verification failed. Please try again.");
|
|
57
|
+
showMessage({ message });
|
|
58
|
+
setStatus(isInvalidOtp ? "invalid" : "idle");
|
|
59
|
+
if (isInvalidOtp) {
|
|
60
|
+
const timeoutId = setTimeout(() => setStatus("idle"), 5000);
|
|
61
|
+
return () => clearTimeout(timeoutId);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}, [onLogin, onTokenChange]);
|
|
65
|
+
/**
|
|
66
|
+
* Automatically sends OTP when email and source are provided.
|
|
67
|
+
* Skip if mfaEnabled & sessionToken is already provided (from MFA flow).
|
|
68
|
+
*/
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (email && source && !mfaEnabled) {
|
|
71
|
+
sendOtp();
|
|
72
|
+
}
|
|
73
|
+
else if (mfaEnabled && sessionToken) {
|
|
74
|
+
// If sessionToken is provided, we already have a session, just initialize
|
|
75
|
+
sessionTokenRef.current = sessionToken;
|
|
76
|
+
}
|
|
77
|
+
}, [email, source, sessionToken, sendOtp]);
|
|
78
|
+
return {
|
|
79
|
+
sendOtp,
|
|
80
|
+
verifyOtp,
|
|
81
|
+
resendOTPCounter,
|
|
82
|
+
status,
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export { useLoginWithEmailOTP };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLoginWithEmailOTP } from "./hooks/internal/useLoginWithEmailOTP";
|
|
3
|
+
import { VerifyEmailOTP } from "../../components/VerifyEmailOTP";
|
|
4
|
+
const LoginWithEmailOTP = ({ email, password, sessionToken, mfaEnabled }) => {
|
|
5
|
+
const { resendOTPCounter, status, verifyOtp, sendOtp, } = useLoginWithEmailOTP({ email, password, source: 'web', sessionToken, mfaEnabled });
|
|
6
|
+
return (_jsx(VerifyEmailOTP, { email: email, validateOTP: verifyOtp, resendOTP: sendOtp, status: status, resendOTPCounter: resendOTPCounter }));
|
|
7
|
+
};
|
|
8
|
+
export default LoginWithEmailOTP;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import { VerifyEmailOTP } from '../../components/VerifyEmailOTP';
|
|
4
|
+
import { useLoginWithEmailOTP } from './hooks/internal/useLoginWithEmailOTP';
|
|
5
|
+
const LoginWithEmailOTP = ({ route }) => {
|
|
6
|
+
const { email, sessionToken, mfaEnabled, password } = route.params;
|
|
7
|
+
const { resendOTPCounter, status, verifyOtp, sendOtp, } = useLoginWithEmailOTP({ email, password, source: Platform.OS, sessionToken, mfaEnabled });
|
|
8
|
+
return (_jsx(VerifyEmailOTP, { email: email, status: status, validateOTP: verifyOtp, resendOTP: sendOtp, resendOTPCounter: resendOTPCounter }));
|
|
9
|
+
};
|
|
10
|
+
export default LoginWithEmailOTP;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
|
|
3
|
+
import { axiosClient } from "../../../../api/axiosClient";
|
|
4
|
+
import { useInterval } from "../../../../hooks/internal/useTimer";
|
|
5
|
+
import { showMessage } from "../../../../helpers/show-message";
|
|
6
|
+
const useLoginWithMobileOTP = ({ phone, source, memberId }) => {
|
|
7
|
+
const [timer, setTimer] = useState(180);
|
|
8
|
+
const [status, setStatus] = useState('timer');
|
|
9
|
+
const [sessionToken, setSessionToken] = useState('');
|
|
10
|
+
const { onLogin, onTokenChange } = useAuthPackageContext();
|
|
11
|
+
useInterval(() => {
|
|
12
|
+
if (!timer) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
setTimer(timer - 1);
|
|
16
|
+
}, 1000);
|
|
17
|
+
const sendOtp = useCallback(() => {
|
|
18
|
+
setStatus('loading');
|
|
19
|
+
axiosClient({
|
|
20
|
+
url: '/auth/login/mobile/v2',
|
|
21
|
+
method: 'POST',
|
|
22
|
+
data: { phone, source, memberId },
|
|
23
|
+
}).then((res) => {
|
|
24
|
+
setSessionToken(res.data.sessionToken);
|
|
25
|
+
setStatus('timer');
|
|
26
|
+
setTimer(180);
|
|
27
|
+
}).catch((err) => {
|
|
28
|
+
console.log(err);
|
|
29
|
+
showMessage({ message: err.response.data.errors[0].message || "Verification failed" });
|
|
30
|
+
});
|
|
31
|
+
}, [phone, source, memberId]);
|
|
32
|
+
const verifyOtp = useCallback((otp) => {
|
|
33
|
+
if (!sessionToken) {
|
|
34
|
+
showMessage({ message: "Session expired. Please resend OTP." });
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
setStatus('loading');
|
|
38
|
+
axiosClient({
|
|
39
|
+
url: '/auth/login/mobile/v2/verify-otp',
|
|
40
|
+
method: 'POST',
|
|
41
|
+
data: { otp, sessionToken },
|
|
42
|
+
}).then((res) => {
|
|
43
|
+
setStatus('valid');
|
|
44
|
+
const { token, member } = res.data;
|
|
45
|
+
onTokenChange(token);
|
|
46
|
+
onLogin({ token, member });
|
|
47
|
+
}).catch((error) => {
|
|
48
|
+
const errorCode = error?.response?.status;
|
|
49
|
+
const isInvalidOtp = errorCode === 400;
|
|
50
|
+
const message = error?.response?.data?.errors?.[0]?.message ||
|
|
51
|
+
(isInvalidOtp
|
|
52
|
+
? "Invalid OTP. Please try again."
|
|
53
|
+
: "Verification failed. Please try again.");
|
|
54
|
+
showMessage({ message });
|
|
55
|
+
setStatus(isInvalidOtp ? "invalid" : "idle");
|
|
56
|
+
if (isInvalidOtp)
|
|
57
|
+
setTimeout(() => setStatus("idle"), 5000);
|
|
58
|
+
});
|
|
59
|
+
}, [sessionToken]);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (memberId && phone && source) {
|
|
62
|
+
sendOtp();
|
|
63
|
+
}
|
|
64
|
+
}, [memberId, phone, source, sendOtp]);
|
|
65
|
+
return {
|
|
66
|
+
timer,
|
|
67
|
+
status,
|
|
68
|
+
verifyOtp,
|
|
69
|
+
sendOtp,
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export { useLoginWithMobileOTP };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { VerifyMobileOTP } from '../../components/VerifyMobileOTP';
|
|
3
|
+
import { useLoginWithMobileOTP } from './hooks/internal/useLoginWithMobileOTP';
|
|
4
|
+
const LoginWithMobileOTP = ({ phone, memberId }) => {
|
|
5
|
+
const { timer, status, verifyOtp, sendOtp, } = useLoginWithMobileOTP({ phone, memberId, source: 'web' });
|
|
6
|
+
return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: verifyOtp, resendOTP: sendOtp }));
|
|
7
|
+
};
|
|
8
|
+
export default LoginWithMobileOTP;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { VerifyMobileOTP } from '../../components/VerifyMobileOTP';
|
|
3
|
+
import { useLoginWithMobileOTP } from './hooks/internal/useLoginWithMobileOTP';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
const LoginWithMobileOTP = ({ route }) => {
|
|
6
|
+
const { phone, memberId } = route.params;
|
|
7
|
+
const { timer, status, verifyOtp, sendOtp, } = useLoginWithMobileOTP({ phone, memberId, source: Platform.OS });
|
|
8
|
+
return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: verifyOtp, resendOTP: sendOtp }));
|
|
9
|
+
};
|
|
10
|
+
export default LoginWithMobileOTP;
|