@truworth/twc-auth 1.2.12-beta.0 → 1.2.12-beta.2
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/README.md +16 -14
- package/build/src/components/AdvancedTransitionWrapper/index.js +2 -8
- package/build/src/components/ConfirmationModal/index.js +2 -2
- package/build/src/components/LoadingAnimation/index.js +50 -0
- package/build/src/constants/password-requirements.js +7 -0
- package/build/src/contexts/AuthContext.js +5 -1
- package/build/src/hooks/useNavigator.js +83 -0
- package/build/src/index.js +8 -0
- package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.js +2 -3
- package/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +11 -4
- package/build/src/screens/CreatePassword/index.js +6 -30
- package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.js +1 -1
- package/build/src/screens/EnterMobile/hooks/internal/useEnterMobile.js +4 -1
- package/build/src/screens/EnterMobile/index.js +10 -10
- package/build/src/screens/EnterMobile/index.native.js +3 -3
- package/build/src/screens/Login/components/LoginWebComponent/index.js +3 -4
- package/build/src/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.js +5 -5
- package/build/src/screens/LoginWithMobileOTP/index.js +2 -2
- package/build/src/screens/LoginWithMobileOTP/index.native.js +2 -2
- 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/SSOLogin/AuthWebView/index.native.js +27 -12
- package/build/src/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.js +3 -2
- package/build/src/screens/SSOLogin/AuthenticationMethods/index.js +1 -0
- package/build/src/screens/SSOLogin/AuthenticationMethods/index.native.js +6 -1
- package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.js +31 -28
- package/build/src/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.js +23 -8
- package/build/src/screens/SSOLogin/SSOCallback/index.native.js +2 -2
- package/build/src/screens/SignUp/components/SignUpForm/index.js +17 -17
- package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +7 -6
- package/build/src/screens/UserConsent/index.js +11 -17
- package/build/src/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.js +3 -4
- package/build/src/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.js +3 -4
- package/build/src/screens/Welcome/index.js +1 -1
- package/build/types/components/ConfirmationModal/index.d.ts +1 -1
- package/build/types/components/ConfirmationModal/types.d.ts +3 -0
- package/build/types/components/LoadingAnimation/index.d.ts +6 -0
- package/build/types/constants/password-requirements.d.ts +4 -0
- package/build/types/contexts/AuthContext.d.ts +3 -1
- package/build/types/contexts/type.d.ts +24 -1
- package/build/types/hooks/useNavigator.d.ts +66 -0
- package/build/types/index.d.ts +5 -0
- package/build/types/navigator/index.native.d.ts +5 -2
- package/build/types/screens/CreatePassword/hooks/internal/useCreatePassword.d.ts +12 -1
- package/build/types/screens/EnterMobile/types.d.ts +2 -2
- package/build/types/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.d.ts +2 -2
- package/build/types/screens/LoginWithMobileOTP/index.d.ts +2 -2
- 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/SSOLogin/AuthenticationMethods/types.d.ts +4 -2
- package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.d.ts +5 -1
- package/build/types/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.d.ts +5 -1
- package/build/types/screens/SSOLogin/SSOCallback/types.d.ts +3 -0
- package/get-metro-config.js +19 -26
- package/package.json +5 -6
|
@@ -1,59 +1,62 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
2
3
|
import { Flex, Typography } from '@truworth/twc-web-design';
|
|
3
4
|
import { useSSOCallback } from '../../hooks/internal/useSSOCallback';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import redirectAnimation from '../../../../../../assets/animation/redirect-home.json';
|
|
5
|
+
import { useNavigator } from '../../../../../hooks/useNavigator';
|
|
6
|
+
import { LoadingAnimation } from '../../../../../components/LoadingAnimation';
|
|
7
7
|
import { RegistrationMethod } from '../../../../../enums';
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const SSOCallbackComponents = () => {
|
|
11
|
-
const router = useRouter();
|
|
8
|
+
const SSOCallbackComponents = ({ authMethodOverride } = {}) => {
|
|
9
|
+
const navigator = useNavigator();
|
|
12
10
|
const [clientId, setClientId] = useState('');
|
|
13
11
|
const [code, setCode] = useState('');
|
|
14
|
-
|
|
12
|
+
const [authMethod, setAuthMethod] = useState(authMethodOverride ?? null);
|
|
13
|
+
const [isReady, setIsReady] = useState(false);
|
|
14
|
+
// Resolve code from query params; clientId from localStorage (only needed for OIDC)
|
|
15
15
|
useEffect(() => {
|
|
16
|
-
const
|
|
16
|
+
const query = navigator.query;
|
|
17
|
+
const codeFromQuery = query.code;
|
|
17
18
|
if (typeof window !== 'undefined') {
|
|
18
19
|
try {
|
|
20
|
+
// clientId only needed for OIDC, not SAML
|
|
19
21
|
const storedClientId = localStorage.getItem('clientId') || '';
|
|
22
|
+
const storedAuthMethod = localStorage.getItem('authMethod') || 'oidc';
|
|
20
23
|
setClientId(storedClientId);
|
|
21
|
-
|
|
24
|
+
if (!authMethodOverride) {
|
|
25
|
+
setAuthMethod(storedAuthMethod);
|
|
26
|
+
}
|
|
27
|
+
setCode(typeof codeFromQuery === 'string' ? codeFromQuery : '');
|
|
28
|
+
setIsReady(true);
|
|
22
29
|
}
|
|
23
30
|
catch (error) {
|
|
24
31
|
console.log('Failed to read from localStorage:', error);
|
|
25
|
-
setCode(typeof
|
|
26
|
-
|
|
32
|
+
setCode(typeof codeFromQuery === 'string' ? codeFromQuery : '');
|
|
33
|
+
setIsReady(true);
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
|
-
}, [
|
|
30
|
-
const { result, error } = useSSOCallback({
|
|
36
|
+
}, [navigator.query, authMethodOverride]);
|
|
37
|
+
const { result, error } = useSSOCallback({
|
|
38
|
+
clientId,
|
|
39
|
+
code,
|
|
40
|
+
authMethod: authMethod ?? 'oidc',
|
|
41
|
+
isReady,
|
|
42
|
+
});
|
|
31
43
|
useEffect(() => {
|
|
32
44
|
if (result?.registrationToken) {
|
|
33
|
-
|
|
34
|
-
pathname: '/registration',
|
|
45
|
+
navigator.pushAbsolute('/registration', {
|
|
35
46
|
query: {
|
|
36
47
|
registrationMethod: RegistrationMethod.SSO,
|
|
37
48
|
...result,
|
|
38
49
|
}
|
|
39
50
|
});
|
|
40
51
|
}
|
|
41
|
-
}, [result,
|
|
52
|
+
}, [result, navigator]);
|
|
42
53
|
useEffect(() => {
|
|
43
54
|
if (error) {
|
|
44
55
|
setTimeout(() => {
|
|
45
|
-
|
|
56
|
+
navigator.back();
|
|
46
57
|
}, 1500);
|
|
47
58
|
}
|
|
48
|
-
}, [error,
|
|
49
|
-
return (_jsx(Flex, { justify: 'center', align: 'center', className: 'h-[100vh]', children: _jsxs("div", { children: [_jsx(
|
|
50
|
-
//@ts-ignore
|
|
51
|
-
, {
|
|
52
|
-
//@ts-ignore
|
|
53
|
-
options: {
|
|
54
|
-
animationData: redirectAnimation,
|
|
55
|
-
loop: true,
|
|
56
|
-
autoplay: true
|
|
57
|
-
}, height: 230, width: 250 }), _jsx(Typography, { size: 'h6', type: 'heading', color: 'gray-400', children: "Authenticating and Redirecting ..." })] }) }));
|
|
59
|
+
}, [error, navigator]);
|
|
60
|
+
return (_jsx(Flex, { justify: 'center', align: 'center', className: 'h-[100vh]', children: _jsxs("div", { children: [_jsx(LoadingAnimation, { height: 230, width: 250 }), _jsx(Typography, { size: 'h6', type: 'heading', color: 'gray-400', children: "Authenticating and Redirecting ..." })] }) }));
|
|
58
61
|
};
|
|
59
62
|
export { SSOCallbackComponents };
|
|
@@ -7,17 +7,27 @@ import { RegistrationMethod } from "../../../../../enums";
|
|
|
7
7
|
* @internal
|
|
8
8
|
* Hook for managing SSOCallback screen state and auth context integration.
|
|
9
9
|
* This hook is not exposed to package consumers.
|
|
10
|
+
*
|
|
11
|
+
* Supports both OIDC and SAML flows:
|
|
12
|
+
* - OIDC: Calls /callback endpoint with authorization code
|
|
13
|
+
* - SAML: Calls /saml-sso-complete endpoint with exchange code
|
|
10
14
|
*/
|
|
11
|
-
const useSSOCallback = ({ clientId, code }) => {
|
|
15
|
+
const useSSOCallback = ({ clientId, code, authMethod, isReady = true }) => {
|
|
12
16
|
const [error, setError] = useState(null);
|
|
13
17
|
const [result, setResult] = useState(null);
|
|
18
|
+
const [hasProcessed, setHasProcessed] = useState(false);
|
|
14
19
|
const { onLogin, onRegistrationMethodChange, onTokenChange } = useAuthPackageContext();
|
|
15
|
-
const
|
|
20
|
+
const processSSOCallback = useCallback((codeToProcess) => {
|
|
16
21
|
setError(null);
|
|
22
|
+
// SAML: Use simplified endpoint that doesn't require clientId
|
|
23
|
+
// OIDC: Use legacy endpoint with clientId
|
|
24
|
+
const endpoint = authMethod === 'saml'
|
|
25
|
+
? `/auth/saml/complete`
|
|
26
|
+
: `/auth/login-sso/${clientId}/callback`;
|
|
17
27
|
axiosClient({
|
|
18
|
-
url:
|
|
28
|
+
url: endpoint,
|
|
19
29
|
method: 'POST',
|
|
20
|
-
data: { code },
|
|
30
|
+
data: { code: codeToProcess },
|
|
21
31
|
}).then((res) => {
|
|
22
32
|
if (res?.data?.registrationToken) {
|
|
23
33
|
onRegistrationMethodChange(RegistrationMethod.SSO);
|
|
@@ -32,12 +42,17 @@ const useSSOCallback = ({ clientId, code }) => {
|
|
|
32
42
|
setError(errorMessage);
|
|
33
43
|
return showMessage({ message: errorMessage });
|
|
34
44
|
});
|
|
35
|
-
}, [clientId,
|
|
45
|
+
}, [clientId, authMethod, onLogin, onRegistrationMethodChange, onTokenChange]);
|
|
36
46
|
useEffect(() => {
|
|
37
|
-
if (code
|
|
38
|
-
|
|
47
|
+
if (!isReady || !code || hasProcessed)
|
|
48
|
+
return;
|
|
49
|
+
// SAML only needs code; OIDC needs both code and clientId
|
|
50
|
+
const canProcess = authMethod === 'saml' || clientId;
|
|
51
|
+
if (canProcess) {
|
|
52
|
+
setHasProcessed(true);
|
|
53
|
+
processSSOCallback(code);
|
|
39
54
|
}
|
|
40
|
-
}, [code, clientId]);
|
|
55
|
+
}, [isReady, code, clientId, authMethod, hasProcessed, processSSOCallback]);
|
|
41
56
|
return { result, error };
|
|
42
57
|
};
|
|
43
58
|
export { useSSOCallback };
|
|
@@ -8,8 +8,8 @@ import loadingSpinner from '../../../../assets/loading-spinner.json';
|
|
|
8
8
|
import Lottie from 'lottie-react-native';
|
|
9
9
|
const { gray } = Colors;
|
|
10
10
|
const SSOCallback = ({ navigation, route }) => {
|
|
11
|
-
const { clientId, code } = route.params;
|
|
12
|
-
const { result, error } = useSSOCallback({ clientId, code });
|
|
11
|
+
const { clientId, code, authMethod } = route.params;
|
|
12
|
+
const { result, error } = useSSOCallback({ clientId, code, authMethod });
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
if (result?.registrationToken) {
|
|
15
15
|
navigation.replace('SignUp', { ...result });
|
|
@@ -7,7 +7,7 @@ import { SupportDetails } from "../../../../components/SupportDetails";
|
|
|
7
7
|
import { ScreenLayout } from "../../../../components/ScreenLayout";
|
|
8
8
|
import { CountryCodeDropdown } from "../../../CountryCode/components/CountryCodeDropdown";
|
|
9
9
|
import { useSignUp } from "../../hooks/internal/useSignUp";
|
|
10
|
-
import {
|
|
10
|
+
import { useNavigator } from "../../../../hooks/useNavigator";
|
|
11
11
|
import ReCAPTCHA from 'react-google-recaptcha';
|
|
12
12
|
import moment from "moment";
|
|
13
13
|
import dayjs from 'dayjs';
|
|
@@ -23,12 +23,13 @@ const SignUpFormComponent = ({ userDetails, onContinue }) => {
|
|
|
23
23
|
const [isHuman, setIsHuman] = useState(isProduction ? false : true);
|
|
24
24
|
const [termsAndConditions, setTermsAndConditions] = useState(false);
|
|
25
25
|
const [selectedCountry, setSelectedCountry] = useState({ countryCode: "in", phoneCode: "91", name: "INDIA" });
|
|
26
|
-
const
|
|
26
|
+
const navigator = useNavigator();
|
|
27
|
+
const routerQuery = navigator.query;
|
|
27
28
|
const form = useForm({
|
|
28
29
|
liveValidation: true,
|
|
29
30
|
defaultValues: {
|
|
30
|
-
firstName: userDetails.firstName ?? getQueryParam(
|
|
31
|
-
lastName: userDetails.lastName ?? getQueryParam(
|
|
31
|
+
firstName: userDetails.firstName ?? getQueryParam(routerQuery.firstName),
|
|
32
|
+
lastName: userDetails.lastName ?? getQueryParam(routerQuery.lastName),
|
|
32
33
|
dateOfBirth: userDetails.selectedDOB,
|
|
33
34
|
email: userDetails.email ?? "",
|
|
34
35
|
phone: userDetails.phone ?? "",
|
|
@@ -38,7 +39,7 @@ const SignUpFormComponent = ({ userDetails, onContinue }) => {
|
|
|
38
39
|
});
|
|
39
40
|
const values = form.watch();
|
|
40
41
|
useEffect(() => {
|
|
41
|
-
const rawMethod =
|
|
42
|
+
const rawMethod = routerQuery.registrationMethod;
|
|
42
43
|
const registrationMethodFromQuery = Array.isArray(rawMethod) ? rawMethod[0] : rawMethod;
|
|
43
44
|
if (typeof registrationMethodFromQuery === 'string') {
|
|
44
45
|
const method = registrationMethodFromQuery.toLowerCase();
|
|
@@ -50,11 +51,11 @@ const SignUpFormComponent = ({ userDetails, onContinue }) => {
|
|
|
50
51
|
}
|
|
51
52
|
onRegistrationMethodChange(method);
|
|
52
53
|
}
|
|
53
|
-
}, [
|
|
54
|
+
}, [routerQuery.registrationMethod]);
|
|
54
55
|
const { loading, setGender, setSelectedDOB, phone, setPhone, email, setEmail, setReferralCode, setCountryCode, countryCode, linkedAccounts, registrationMethod, onRegistrationMethodChange, linkedAccountsSheet, showLinkedAccountsSheet, handleFirstNameChange, handleLastNameChange, handleEmailChange, handleMobileChange, handleSubmit, getLoginTypeText, appName, termsAndConditionsUrl } = useSignUp();
|
|
55
56
|
useEffect(() => {
|
|
56
57
|
if (!registrationMethod) {
|
|
57
|
-
const registrationMethodFromQuery =
|
|
58
|
+
const registrationMethodFromQuery = routerQuery.registrationMethod;
|
|
58
59
|
if (typeof registrationMethodFromQuery === 'string') {
|
|
59
60
|
const method = registrationMethodFromQuery.toLowerCase();
|
|
60
61
|
onRegistrationMethodChange(method);
|
|
@@ -63,10 +64,10 @@ const SignUpFormComponent = ({ userDetails, onContinue }) => {
|
|
|
63
64
|
;
|
|
64
65
|
}, [registrationMethod]);
|
|
65
66
|
useEffect(() => {
|
|
66
|
-
if (
|
|
67
|
+
if (routerQuery.registrationToken) {
|
|
67
68
|
form.reset({
|
|
68
|
-
firstName: getQueryParam(
|
|
69
|
-
lastName: getQueryParam(
|
|
69
|
+
firstName: getQueryParam(routerQuery.firstName) ?? userDetails.firstName,
|
|
70
|
+
lastName: getQueryParam(routerQuery.lastName) ?? userDetails.lastName,
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
}, []);
|
|
@@ -93,7 +94,7 @@ const SignUpFormComponent = ({ userDetails, onContinue }) => {
|
|
|
93
94
|
setIsHuman(Boolean(value));
|
|
94
95
|
};
|
|
95
96
|
const onGoToLogin = () => {
|
|
96
|
-
|
|
97
|
+
navigator.pushAbsolute('/login');
|
|
97
98
|
};
|
|
98
99
|
const onProceed = () => {
|
|
99
100
|
const params = {
|
|
@@ -102,8 +103,8 @@ const SignUpFormComponent = ({ userDetails, onContinue }) => {
|
|
|
102
103
|
gender: values.gender,
|
|
103
104
|
selectedDOB: values.dateOfBirth,
|
|
104
105
|
referralCode: values.referralCode,
|
|
105
|
-
email: email.length > 0 ? email : getQueryParam(
|
|
106
|
-
phone: phone.length > 0 ? phone : getQueryParam(
|
|
106
|
+
email: email.length > 0 ? email : getQueryParam(routerQuery.email) || '',
|
|
107
|
+
phone: phone.length > 0 ? phone : getQueryParam(routerQuery.phone) || '',
|
|
107
108
|
countryCode,
|
|
108
109
|
};
|
|
109
110
|
onContinue(params);
|
|
@@ -197,12 +198,11 @@ const SignUpFormComponent = ({ userDetails, onContinue }) => {
|
|
|
197
198
|
: _jsx(Typography, { type: "utility", size: "small", color: "red-600", children: "reCAPTCHA misconfigured. Set NEXT_PUBLIC_RECAPTCHA_SITE_KEY." })), _jsx(Row, { className: "py-0 my-5", children: _jsx(Col, { children: _jsx(CustomCheckbox, { checked: termsAndConditions, onClick: (e) => {
|
|
198
199
|
setTermsAndConditions(prev => !prev);
|
|
199
200
|
}, className: "mt-4", label: _jsxs(Typography, { type: "body", size: "medium", children: ["I accept the", _jsx("a", { target: "_blank", rel: "noopener noreferrer", href: termsAndConditionsUrl, className: "px-1 text-primary", children: "Terms & Conditions" }), "listed on ", appName] }) }) }) })] }) }), _jsxs(Flex, { align: 'center', className: 'p-0 mt-4', children: [_jsx(Typography, { type: "body", size: "large", className: "text-gray-700", children: "Already have an account?" }), _jsx(Button, { label: "Sign-In", variant: "link", size: "medium", className: "ml-2 h-auto px-0", onClick: onGoToLogin })] }), linkedAccountsSheet &&
|
|
200
|
-
_jsx(LinkedAccountsSheet, { phone: phone, countryCode: countryCode, visible: linkedAccountsSheet, hide: () => showLinkedAccountsSheet(false), linkedAccounts: linkedAccounts, getLoginTypeText: getLoginTypeText })] }));
|
|
201
|
+
_jsx(LinkedAccountsSheet, { phone: phone, countryCode: countryCode, visible: linkedAccountsSheet, hide: () => showLinkedAccountsSheet(false), linkedAccounts: linkedAccounts, getLoginTypeText: getLoginTypeText, onGoToLogin: onGoToLogin })] }));
|
|
201
202
|
};
|
|
202
|
-
const LinkedAccountsSheet = ({ visible, hide, linkedAccounts, countryCode, phone, getLoginTypeText }) => {
|
|
203
|
-
const router = useRouter();
|
|
203
|
+
const LinkedAccountsSheet = ({ visible, hide, linkedAccounts, countryCode, phone, getLoginTypeText, onGoToLogin }) => {
|
|
204
204
|
return (_jsxs(ResponsiveModal, { open: visible, onClose: hide, onOpenChange: hide, title: _jsxs(_Fragment, { children: [_jsx(Typography, { type: "heading", size: "h6", children: "Mobile Number Already Linked" }), _jsxs(Typography, { type: "utility", size: "medium", color: "gray-600", className: "mt-2 mb-3", children: ["The mobile number +", countryCode, " ", String(phone).replace(/\d(?=\d{2})/g, 'X'), " is linked to the following ", linkedAccounts.length === 1 ? 'account' : `${linkedAccounts.length} accounts`, "."] }), _jsx("hr", {})] }), centered: true, showCloseButton: false, className: "px-0", footer: _jsxs(Flex, { direction: "column", children: [_jsx(Button, { isFullWidth: true, variant: "primary", label: "Go to Login", onClick: () => {
|
|
205
|
-
|
|
205
|
+
onGoToLogin();
|
|
206
206
|
hide();
|
|
207
207
|
}, className: "!ml-0 mb-[-4px]" }), _jsx(SupportDetails, {})] }), children: [_jsx(Typography, { type: "utility", size: "medium", children: "Please login through any of the below account or contact our support team for assistance" }), linkedAccounts.map((item) => {
|
|
208
208
|
const key = item.memberId ?? item.email ?? `${item.loginType}-${item.createdOn}`;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Flex } from "@truworth/twc-web-design";
|
|
3
|
-
import { useRouter } from "next/router";
|
|
4
3
|
import { useEffect, useState } from "react";
|
|
5
4
|
import { AdvancedTransitionWrapper } from "../../../../components/AdvancedTransitionWrapper";
|
|
6
5
|
import { SignUpFormComponent } from "../SignUpForm";
|
|
7
6
|
import CreatePassword from "../../../CreatePassword";
|
|
8
7
|
import UserConsent from "../../../UserConsent";
|
|
8
|
+
import { useNavigator } from "../../../../hooks/useNavigator";
|
|
9
9
|
const SignUpWebComponent = () => {
|
|
10
|
-
const
|
|
10
|
+
const navigator = useNavigator();
|
|
11
11
|
const [signUpStep, setSignUpStep] = useState('registration');
|
|
12
12
|
const [userDetails, setUserDetails] = useState({});
|
|
13
13
|
const [registrationToken, setRegistrationToken] = useState('');
|
|
14
14
|
const [fbUserId, setFbUserId] = useState('');
|
|
15
15
|
const [googleUserId, setGoogleUserId] = useState('');
|
|
16
16
|
useEffect(() => {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const query = navigator.query;
|
|
18
|
+
const rawRegistrationToken = query.registrationToken;
|
|
19
|
+
const rawFbUserId = query.fbUserId;
|
|
20
|
+
const rawGoogleUserId = query.googleUserId;
|
|
20
21
|
if (typeof rawRegistrationToken === 'string') {
|
|
21
22
|
setRegistrationToken(rawRegistrationToken);
|
|
22
23
|
}
|
|
@@ -26,7 +27,7 @@ const SignUpWebComponent = () => {
|
|
|
26
27
|
if (typeof rawGoogleUserId === 'string') {
|
|
27
28
|
setGoogleUserId(rawGoogleUserId);
|
|
28
29
|
}
|
|
29
|
-
}, [
|
|
30
|
+
}, [navigator.query.registrationToken]);
|
|
30
31
|
const renderStep = () => {
|
|
31
32
|
switch (signUpStep) {
|
|
32
33
|
case 'registration':
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import dynamic from 'next/dynamic';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import Image from 'next/image';
|
|
5
3
|
import { useEffect, useState } from "react";
|
|
6
4
|
import { Info } from 'lucide-react';
|
|
7
|
-
import { useRouter } from "next/router";
|
|
8
5
|
import { Flex, Typography, ResponsiveModal as Modal, Button, ResponsiveModal } from '@truworth/twc-web-design';
|
|
9
6
|
import { useAuthPackageContext } from '../../hooks/internal/useAuthPackageContext';
|
|
10
7
|
import { CDN_IMAGES_URL } from '../../constants/cdn-url';
|
|
11
8
|
import { useConsent } from './hooks/internal/useConsent';
|
|
12
9
|
import { ScreenLayout } from "../../components/ScreenLayout";
|
|
10
|
+
import { LoadingAnimation } from '../../components/LoadingAnimation';
|
|
13
11
|
import VerifyMobile from "../VerifyMobile";
|
|
14
12
|
import VerifyEmail from "../VerifyEmail";
|
|
15
|
-
import redirectHome from '../../../assets/animation/redirect-home.json';
|
|
16
|
-
const Lottie = dynamic(() => import('react-lottie'), { ssr: false });
|
|
17
13
|
const UserConsent = ({ userDetails, handleBack }) => {
|
|
18
14
|
const { email, phone } = userDetails || {};
|
|
19
15
|
const [redirectModal, setRedirectModal] = useState(false);
|
|
@@ -54,7 +50,7 @@ const UserConsent = ({ userDetails, handleBack }) => {
|
|
|
54
50
|
: typeof LogoComponent === 'function'
|
|
55
51
|
? React.createElement(LogoComponent)
|
|
56
52
|
:
|
|
57
|
-
_jsx(
|
|
53
|
+
_jsx("img", { src: `${CDN_IMAGES_URL ?? ''}/new-twc_logo.svg`, alt: "logo", width: 176, height: 40, className: "mb-9 h-auto w-[176px]" }), _jsx(Flex, { className: 'p-0 lg:gap-8 flex-col-reverse lg:flex-row', children: _jsxs(Flex, { direction: 'column', className: 'p-0', children: [_jsx(Typography, { type: 'heading', size: 'h5', className: 'mb-3 text-gray-900', children: "Thank you for your trust & sharing your personal information with us." }), _jsx(Typography, { type: 'heading', size: 'h6', className: "mb-6 text-gray-600", children: "User Consent" }), _jsxs(Typography, { type: 'body', size: 'medium', className: 'lg:text-sm text-gray-800', children: ["I provide ", appName, " with the consent to collect, use, store, share, and/or otherwise process my personal information including but not limited to Name, Gender (biological sex at the time of birth), Date of Birth and Email Address, Mobile Number, and other health vital & lifestyle information). The information is collected for the specified, explicit and legitimate purposes only - which is to assess me or my family's Health Risk, schedule Investigations, Health Check-ups, Doctor Consultations, Procedure, Treatment, provide Health & Wellness Coaching and Payments and ensure that the same is not excessive in relation to the purposes for which it is being collected, and also ensure that such personal information is retained only as long as the user is registered on the platform. I, also agree to receive Email / SMS/WhatsApp alerts and calls in connection with me or my family's health & wellness services."] }), _jsxs(Typography, { type: 'body', size: 'medium', className: "lg:text-sm mt-5 text-gray-800", children: ["Please refer to the 'Terms & Conditions', Privacy & Data Protection Policy listed on ", _jsxs("a", { href: privacyPolicyUrl, target: '_blank', rel: "noopener noreferrer", className: "text-primary block font-semibold", children: [appName, "'s Privacy & Data Protection Policy"] })] }), _jsxs(Flex, { className: '!px-0 flex-col lg:flex-row mt-8', children: [_jsx(Button, { label: "Yes, I Agree", variant: "primary", loading: loading, onClick: () => onAgree({
|
|
58
54
|
userDetails,
|
|
59
55
|
source: 'web',
|
|
60
56
|
onResult: onAgreeHandler
|
|
@@ -67,19 +63,17 @@ const UserConsent = ({ userDetails, handleBack }) => {
|
|
|
67
63
|
} })] }));
|
|
68
64
|
};
|
|
69
65
|
const RedirectToHomeModal = ({ redirectModal }) => {
|
|
70
|
-
const
|
|
66
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
71
67
|
useEffect(() => {
|
|
72
|
-
|
|
68
|
+
setIsMounted(true);
|
|
69
|
+
// Redirect after a short delay to show the modal
|
|
70
|
+
const timer = setTimeout(() => {
|
|
71
|
+
// Use window.location for full page navigation to avoid context issues
|
|
72
|
+
window.location.href = '/login';
|
|
73
|
+
}, 2000);
|
|
74
|
+
return () => clearTimeout(timer);
|
|
73
75
|
}, []);
|
|
74
|
-
return (_jsxs(Modal, { title: "", open: redirectModal, showCloseButton: false, footer: null, children: [_jsx(
|
|
75
|
-
/* @ts-ignore */
|
|
76
|
-
, {
|
|
77
|
-
/* @ts-ignore */
|
|
78
|
-
options: {
|
|
79
|
-
animationData: redirectHome,
|
|
80
|
-
loop: true,
|
|
81
|
-
autoplay: true
|
|
82
|
-
}, height: 150, width: 250 }), _jsxs(Flex, { direction: 'column', style: { marginTop: "-30px" }, children: [_jsx(Typography, { type: 'heading', size: 'h5', className: 'text-center mb-6', color: "text-gray-800", children: "Redirecting to the website homepage" }), _jsxs(Flex, { children: [_jsx(Info, { color: 'blue' }), _jsx(Typography, { type: 'body', size: 'small', className: 'text-center mb-6', color: "text-gray-800", children: "We have not stored any information you shared during registration." })] })] })] }));
|
|
76
|
+
return (_jsxs(Modal, { title: "", open: redirectModal, showCloseButton: false, footer: null, children: [isMounted && (_jsx(LoadingAnimation, { height: 150, width: 250 })), _jsxs(Flex, { direction: 'column', style: { marginTop: isMounted ? "-30px" : "0" }, children: [_jsx(Typography, { type: 'heading', size: 'h5', className: 'text-center mb-6', color: "text-gray-800", children: "Redirecting to the website homepage" }), _jsxs(Flex, { children: [_jsx(Info, { color: 'blue' }), _jsx(Typography, { type: 'body', size: 'small', className: 'text-center mb-6', color: "text-gray-800", children: "We have not stored any information you shared during registration." })] })] })] }));
|
|
83
77
|
};
|
|
84
78
|
const VerifyMobileModal = ({ visible, hide, sessionToken, phone }) => {
|
|
85
79
|
return (_jsx(ResponsiveModal, { title: 'Verify Mobile', open: visible, onClose: hide, onOpenChange: hide, maskClosable: false, showCloseButton: false, children: _jsx(VerifyMobile, { sessionToken: sessionToken, phone: phone }) }));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useEffect, useCallback, useState } from "react";
|
|
2
|
-
import { useRouter } from "next/router";
|
|
3
2
|
import { useAuthPackageContext } from "../../../../../hooks/internal/useAuthPackageContext";
|
|
4
3
|
import { RegistrationMethod } from "../../../../../enums";
|
|
5
4
|
import { handleFacebookAuth } from "../../commonSocialAuth";
|
|
6
5
|
import { showMessage } from "../../../../../helpers/show-message";
|
|
6
|
+
import { useNavigator } from "../../../../../hooks/useNavigator";
|
|
7
7
|
export const useFacebookAuth = () => {
|
|
8
8
|
const [error, setError] = useState(null);
|
|
9
9
|
const { onLogin, socialLoginConfig, onRegistrationMethodChange, onTokenChange } = useAuthPackageContext();
|
|
10
|
-
const
|
|
10
|
+
const navigator = useNavigator();
|
|
11
11
|
const facebookAppId = socialLoginConfig?.facebook?.webClientId;
|
|
12
12
|
// Load Facebook SDK once
|
|
13
13
|
useEffect(() => {
|
|
@@ -79,8 +79,7 @@ export const useFacebookAuth = () => {
|
|
|
79
79
|
switch (result.status) {
|
|
80
80
|
case "REGISTER":
|
|
81
81
|
onRegistrationMethodChange(RegistrationMethod.SOCIAL);
|
|
82
|
-
return
|
|
83
|
-
pathname: "/registration",
|
|
82
|
+
return navigator.pushAbsolute("/registration", {
|
|
84
83
|
query: {
|
|
85
84
|
email,
|
|
86
85
|
firstName: nameParts[0],
|
|
@@ -3,10 +3,10 @@ import { useGoogleLogin } from "react-google-login";
|
|
|
3
3
|
import { useAuthPackageContext } from "../../../../../hooks/internal/useAuthPackageContext";
|
|
4
4
|
import { showMessage } from "../../../../../helpers/show-message";
|
|
5
5
|
import { RegistrationMethod } from "../../../../../enums";
|
|
6
|
-
import {
|
|
6
|
+
import { useNavigator } from "../../../../../hooks/useNavigator";
|
|
7
7
|
import { handleGoogleAuth } from "../../commonSocialAuth";
|
|
8
8
|
export const useGoogleAuth = () => {
|
|
9
|
-
const
|
|
9
|
+
const navigator = useNavigator();
|
|
10
10
|
const { onLogin, socialLoginConfig, onRegistrationMethodChange, onTokenChange } = useAuthPackageContext();
|
|
11
11
|
const googleAppId = socialLoginConfig?.google?.webClientId;
|
|
12
12
|
const onSuccess = async (response) => {
|
|
@@ -20,8 +20,7 @@ export const useGoogleAuth = () => {
|
|
|
20
20
|
switch (result.status) {
|
|
21
21
|
case "REGISTER":
|
|
22
22
|
onRegistrationMethodChange(RegistrationMethod.SOCIAL);
|
|
23
|
-
return
|
|
24
|
-
pathname: "/registration",
|
|
23
|
+
return navigator.pushAbsolute("/registration", {
|
|
25
24
|
query: {
|
|
26
25
|
email,
|
|
27
26
|
firstName: givenName,
|
|
@@ -23,6 +23,6 @@ const Welcome = ({ onClickEnterEmail }) => {
|
|
|
23
23
|
// Fallback to default logo
|
|
24
24
|
return (_jsx("img", { width: 160, height: 35, className: 'md:mt-0 mt-6 md:h-[40px] h-[30px]', src: `${CDN_IMAGES_URL}/new-twc_logo.svg` }));
|
|
25
25
|
};
|
|
26
|
-
return (_jsx(AdvancedTransitionWrapper, { type: 'slide', duration: 0.3, children: _jsxs(Flex, { justify: 'center', align: "center", direction: 'column', className: 'h-screen w-[80%] mx-auto gap-6', children: [renderLogo(), _jsxs(Flex, { justify: "center", align: "center", direction: "column", className: 'gap-2', children: [_jsx(Typography, { type: 'heading', size: 'h5', className: 'text-center text-
|
|
26
|
+
return (_jsx(AdvancedTransitionWrapper, { type: 'slide', duration: 0.3, children: _jsxs(Flex, { justify: 'center', align: "center", direction: 'column', className: 'h-screen w-[80%] mx-auto gap-6', children: [renderLogo(), _jsxs(Flex, { justify: "center", align: "center", direction: "column", className: 'gap-2', children: [_jsx(Typography, { type: 'heading', size: 'h5', className: 'text-center text-gray-900 font-semibold', children: "Welcome!" }), _jsx(Typography, { type: 'utility', size: 'large', color: "gray-400", className: 'text-center font-semibold', children: "Select an option to proceed" })] }), _jsx(Button, { label: "Enter Your Email", variant: "secondary", onClick: onClickEnterEmail, leftIcon: _jsx(Mail, { size: 20 }), isFullWidth: true })] }) }));
|
|
27
27
|
};
|
|
28
28
|
export default Welcome;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ConfirmationModalProps } from './types';
|
|
2
|
-
declare const ConfirmationModal: ({ title, visible, onClose, onProceed, onDismiss, primaryLabel, secondaryLabel, iconName,
|
|
2
|
+
declare const ConfirmationModal: ({ title, visible, onClose, onProceed, onDismiss, primaryLabel, secondaryLabel, iconName, iconClassName, description }: ConfirmationModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export { ConfirmationModal };
|
|
@@ -4,7 +4,10 @@ type ConfirmationModalProps = {
|
|
|
4
4
|
primaryLabel: string;
|
|
5
5
|
secondaryLabel?: string;
|
|
6
6
|
iconName?: string;
|
|
7
|
+
/** @deprecated Use iconClassName instead for Tailwind classes */
|
|
7
8
|
iconColor?: string;
|
|
9
|
+
/** Tailwind classes for icon styling, e.g. "text-primary" or "text-utility-warning-main" */
|
|
10
|
+
iconClassName?: string;
|
|
8
11
|
onClose: () => void;
|
|
9
12
|
onProceed?: () => void;
|
|
10
13
|
onDismiss?: () => void;
|
|
@@ -21,6 +21,8 @@ declare const AuthPackageContext: React.Context<AuthPackageContextValue | null>;
|
|
|
21
21
|
* Wraps both AuthContext (public) and AuthPackageContext (internal).
|
|
22
22
|
*
|
|
23
23
|
* @param children - React children to be rendered inside the provider
|
|
24
|
+
* @param router - Router adapter for navigation in web apps only
|
|
25
|
+
* @param basePath - Base path for web routes where the auth module is mounted (default: '')
|
|
24
26
|
* @param LogoComponent - Optional component for branding/logo in auth flows
|
|
25
27
|
* @param session - Initial session containing token & sessionTimeout (if available)
|
|
26
28
|
* @param supportEmail - Optional support email for auth flows
|
|
@@ -32,7 +34,7 @@ declare const AuthPackageContext: React.Context<AuthPackageContextValue | null>;
|
|
|
32
34
|
* @param openChatSupport - Optional callback to open chat support
|
|
33
35
|
* @param socialLoginConfig - Optional social login configuration
|
|
34
36
|
*/
|
|
35
|
-
declare const AuthProvider: ({ children, LogoComponent, session, appConfig, onLogin, onLogout, onLaunchAuthSession, onRefreshSession, openChatSupport, socialLoginConfig }: AuthContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
declare const AuthProvider: ({ children, router, basePath, LogoComponent, session, appConfig, onLogin, onLogout, onLaunchAuthSession, onRefreshSession, openChatSupport, socialLoginConfig }: AuthContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
38
|
export { AuthProvider };
|
|
37
39
|
export default AuthContext;
|
|
38
40
|
export { AuthPackageContext };
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ClientProfile, MemberProfile, Profile, Partner, RegistrationMethod } from '../types/types';
|
|
3
3
|
import type { SocialLoginsEnum } from '../enums';
|
|
4
|
+
/**
|
|
5
|
+
* Router adapter interface that host apps must implement.
|
|
6
|
+
* This allows the package to be framework-agnostic.
|
|
7
|
+
*/
|
|
8
|
+
type RouterAdapter = {
|
|
9
|
+
push: (path: string, options?: {
|
|
10
|
+
query?: Record<string, string | string[] | undefined>;
|
|
11
|
+
}) => void;
|
|
12
|
+
replace: (path: string, options?: {
|
|
13
|
+
query?: Record<string, string | string[] | undefined>;
|
|
14
|
+
}) => void;
|
|
15
|
+
back: () => void;
|
|
16
|
+
getQuery: () => Record<string, string | string[] | undefined>;
|
|
17
|
+
getPathname: () => string;
|
|
18
|
+
};
|
|
4
19
|
interface LoginResponse {
|
|
5
20
|
token: string;
|
|
6
21
|
member?: MemberProfile;
|
|
@@ -17,6 +32,10 @@ interface AppConfig {
|
|
|
17
32
|
}
|
|
18
33
|
interface AuthContextProps {
|
|
19
34
|
children: React.ReactNode;
|
|
35
|
+
/** Router adapter for navigation - must be provided by web host app */
|
|
36
|
+
router?: RouterAdapter;
|
|
37
|
+
/** Base path where the auth module is mounted (e.g., '' for root or '/auth') */
|
|
38
|
+
basePath?: string;
|
|
20
39
|
LogoComponent?: React.ComponentType | React.ReactElement;
|
|
21
40
|
session: {
|
|
22
41
|
token: string;
|
|
@@ -45,6 +64,10 @@ interface AuthContextValue {
|
|
|
45
64
|
}
|
|
46
65
|
interface AuthPackageContextValue {
|
|
47
66
|
token: string;
|
|
67
|
+
/** Router adapter for navigation */
|
|
68
|
+
router?: RouterAdapter;
|
|
69
|
+
/** Base path where the auth module is mounted */
|
|
70
|
+
basePath?: string;
|
|
48
71
|
LogoComponent?: React.ComponentType | React.ReactElement;
|
|
49
72
|
appConfig: AppConfig;
|
|
50
73
|
socialLoginConfig?: Partial<Record<SocialLoginsEnum, {
|
|
@@ -68,4 +91,4 @@ interface AuthConfigResponse {
|
|
|
68
91
|
isInternational: boolean;
|
|
69
92
|
defaultCircle: any;
|
|
70
93
|
}
|
|
71
|
-
export type { LoginResponse, AuthContextProps, AuthContextValue, MemberProfile, ClientProfile, AuthConfigResponse, Profile, Partner, AuthPackageContextValue, RefreshSessionResponse };
|
|
94
|
+
export type { LoginResponse, AuthContextProps, AuthContextValue, MemberProfile, ClientProfile, AuthConfigResponse, Profile, Partner, AuthPackageContextValue, RefreshSessionResponse, RouterAdapter };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useNavigator Hook
|
|
3
|
+
*
|
|
4
|
+
* Provides framework-agnostic navigation capabilities.
|
|
5
|
+
* Uses the RouterAdapter provided by the host app through AuthProvider.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const navigator = useNavigator();
|
|
10
|
+
*
|
|
11
|
+
* // Relative navigation (uses basePath)
|
|
12
|
+
* navigator.push('/registration');
|
|
13
|
+
*
|
|
14
|
+
* // Absolute navigation (ignores basePath)
|
|
15
|
+
* navigator.pushAbsolute('/dashboard');
|
|
16
|
+
*
|
|
17
|
+
* // With query params
|
|
18
|
+
* navigator.push('/registration', { query: { email: 'test@example.com' } });
|
|
19
|
+
*
|
|
20
|
+
* // Access query params
|
|
21
|
+
* const { email } = navigator.query;
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const useNavigator: () => {
|
|
25
|
+
/**
|
|
26
|
+
* Navigate to a path relative to basePath
|
|
27
|
+
*/
|
|
28
|
+
push: (path: string, options?: {
|
|
29
|
+
query?: Record<string, string | string[] | undefined>;
|
|
30
|
+
}) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Replace current path with a path relative to basePath
|
|
33
|
+
*/
|
|
34
|
+
replace: (path: string, options?: {
|
|
35
|
+
query?: Record<string, string | string[] | undefined>;
|
|
36
|
+
}) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Navigate to an absolute path (ignores basePath)
|
|
39
|
+
*/
|
|
40
|
+
pushAbsolute: (path: string, options?: {
|
|
41
|
+
query?: Record<string, string | string[] | undefined>;
|
|
42
|
+
}) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Replace with an absolute path (ignores basePath)
|
|
45
|
+
*/
|
|
46
|
+
replaceAbsolute: (path: string, options?: {
|
|
47
|
+
query?: Record<string, string | string[] | undefined>;
|
|
48
|
+
}) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Go back to the previous page
|
|
51
|
+
*/
|
|
52
|
+
back: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Get current query parameters
|
|
55
|
+
*/
|
|
56
|
+
readonly query: Record<string, string | string[] | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Get current pathname
|
|
59
|
+
*/
|
|
60
|
+
readonly pathname: string;
|
|
61
|
+
/**
|
|
62
|
+
* The base path where the auth module is mounted
|
|
63
|
+
*/
|
|
64
|
+
basePath: string;
|
|
65
|
+
};
|
|
66
|
+
export { useNavigator };
|
package/build/types/index.d.ts
CHANGED
|
@@ -3,8 +3,13 @@ export { default as AuthContext } from './contexts/AuthContext';
|
|
|
3
3
|
export * from './contexts/type';
|
|
4
4
|
export * from './hooks/useAuthContext';
|
|
5
5
|
export * from './hooks/useRequest';
|
|
6
|
+
export * from './hooks/useNavigator';
|
|
6
7
|
export * from './api/axiosClient';
|
|
7
8
|
export * from './navigator';
|
|
8
9
|
export * from './screens/Login/components/LoginWebComponent/index';
|
|
9
10
|
export * from './screens/SignUp/components/SignUpWebComponent/index';
|
|
10
11
|
export * from './screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index';
|
|
12
|
+
export * from './screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent';
|
|
13
|
+
export * from './screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent';
|
|
14
|
+
export * from './screens/Profile';
|
|
15
|
+
export { strongPasswordRequirements } from './constants/password-requirements';
|