@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,5 +1,6 @@
|
|
|
1
1
|
import { type NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
2
2
|
import type { Client, PersonalDetails } from '../types/types';
|
|
3
|
+
import type { AuthMethod } from '../screens/SSOLogin/AuthenticationMethods/types';
|
|
3
4
|
declare const AuthNavigator: () => import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
export { AuthNavigator };
|
|
5
6
|
export type AuthStackParamList = {
|
|
@@ -55,16 +56,18 @@ export type AuthStackParamList = {
|
|
|
55
56
|
SSOCallback: {
|
|
56
57
|
code?: string;
|
|
57
58
|
clientId: number;
|
|
59
|
+
authMethod?: AuthMethod;
|
|
58
60
|
};
|
|
59
61
|
SSOAuthWebView: {
|
|
60
62
|
clientId: number;
|
|
61
63
|
authenticationUrl: string;
|
|
62
|
-
redirectUri
|
|
64
|
+
redirectUri?: string;
|
|
65
|
+
authMethod: AuthMethod;
|
|
63
66
|
};
|
|
64
67
|
EnterMobile: undefined;
|
|
65
68
|
LoginWithMobileOTP: {
|
|
66
69
|
phone: string;
|
|
67
|
-
|
|
70
|
+
memberId: string;
|
|
68
71
|
};
|
|
69
72
|
VerifyLinkPrimaryAccountEmailOTP: {
|
|
70
73
|
email: string;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
interface UseCreatePasswordProps {
|
|
2
|
+
/** Initial password value (for preserving state when navigating back) */
|
|
3
|
+
initialPassword?: string;
|
|
4
|
+
/** Initial confirm password value (for preserving state when navigating back) */
|
|
5
|
+
initialConfirmPassword?: string;
|
|
6
|
+
}
|
|
1
7
|
/**
|
|
2
8
|
* @internal
|
|
3
9
|
* Internal hook for managing CreatePassword screen state and auth context integration.
|
|
4
10
|
* Not exposed to package consumers.
|
|
11
|
+
*
|
|
12
|
+
* Both web and native use the same pattern:
|
|
13
|
+
* - Hook manages password state internally
|
|
14
|
+
* - Use handlePassword/handleConfirmPassword to update state
|
|
15
|
+
* - Optional initial values for preserving state when navigating back
|
|
5
16
|
*/
|
|
6
|
-
declare const useCreatePassword: () => {
|
|
17
|
+
declare const useCreatePassword: (props?: UseCreatePasswordProps) => {
|
|
7
18
|
password: string;
|
|
8
19
|
setPassword: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
9
20
|
confirmPassword: string;
|
|
@@ -32,13 +32,13 @@ interface VerifyLinkedMobileModalProps {
|
|
|
32
32
|
interface LoginWithMobileOTPModalProps {
|
|
33
33
|
show: boolean;
|
|
34
34
|
hide: () => void;
|
|
35
|
-
|
|
35
|
+
memberId: string;
|
|
36
36
|
phone: string;
|
|
37
37
|
}
|
|
38
38
|
type ValidatePhoneParams = {
|
|
39
39
|
onValidate: (args: {
|
|
40
40
|
mobileExist: boolean;
|
|
41
|
-
|
|
41
|
+
memberId: string;
|
|
42
42
|
}) => void;
|
|
43
43
|
};
|
|
44
44
|
export type { Members, ValidatePhoneParams, MultipleAccount, VerifyLinkedEmailModalProps, VerifyLinkedMobileModalProps, LoginWithMobileOTPModalProps };
|
package/build/types/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface PartnerLoginWebComponentProps {
|
|
2
|
+
/**
|
|
3
|
+
* Partner key - can be passed as prop (for react-router) or extracted from query params (for Next.js)
|
|
4
|
+
*/
|
|
5
|
+
partner?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* PartnerLoginWebComponent
|
|
9
|
+
*
|
|
10
|
+
* Handles partner SSO authentication flow for web applications.
|
|
11
|
+
* Extracts token and partner from URL query params, authenticates with backend,
|
|
12
|
+
* and redirects to the specified path on success.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // In your app's partner login route (react-router - pass partner from useParams)
|
|
17
|
+
* const { partner } = useParams();
|
|
18
|
+
* <PartnerLoginWebComponent partner={partner} />
|
|
19
|
+
*
|
|
20
|
+
* // In Next.js (partner comes from query params automatically)
|
|
21
|
+
* <PartnerLoginWebComponent />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const PartnerLoginWebComponent: ({ partner: partnerProp }: PartnerLoginWebComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export { PartnerLoginWebComponent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UsePartnerLoginProps, UsePartnerLoginResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Hook for managing Partner SSO Login authentication.
|
|
5
|
+
* This hook is not exposed to package consumers.
|
|
6
|
+
*/
|
|
7
|
+
declare const usePartnerLogin: ({ partner, token, path }: UsePartnerLoginProps) => UsePartnerLoginResult;
|
|
8
|
+
export { usePartnerLogin };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface PartnerLoginProps {
|
|
2
|
+
/**
|
|
3
|
+
* Called after successful authentication
|
|
4
|
+
*/
|
|
5
|
+
onSuccess?: (data: PartnerLoginSuccessData) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Called when authentication fails
|
|
8
|
+
*/
|
|
9
|
+
onError?: (error: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface PartnerLoginSuccessData {
|
|
12
|
+
token: string;
|
|
13
|
+
member: {
|
|
14
|
+
memberId: string;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
name: string;
|
|
18
|
+
email: string;
|
|
19
|
+
gender: string;
|
|
20
|
+
dateOfBirth: string;
|
|
21
|
+
clientId: number;
|
|
22
|
+
plan: number;
|
|
23
|
+
planExpiryDate: string | null;
|
|
24
|
+
};
|
|
25
|
+
redirectPath: string;
|
|
26
|
+
}
|
|
27
|
+
export interface UsePartnerLoginProps {
|
|
28
|
+
partner: string;
|
|
29
|
+
token: string;
|
|
30
|
+
path?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface UsePartnerLoginResult {
|
|
33
|
+
isLoading: boolean;
|
|
34
|
+
error: string | null;
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface PartnerRegistrationWebComponentProps {
|
|
2
|
+
/**
|
|
3
|
+
* Partner key - can be passed as prop (for react-router) or extracted from query params (for Next.js)
|
|
4
|
+
*/
|
|
5
|
+
partner?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* PartnerRegistrationWebComponent
|
|
9
|
+
*
|
|
10
|
+
* Handles partner SSO registration flow for web applications.
|
|
11
|
+
* Pre-fills form with data from JWT token and collects missing information.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // In your app's partner registration route (react-router - pass partner from useParams)
|
|
16
|
+
* const { partner } = useParams();
|
|
17
|
+
* <PartnerRegistrationWebComponent partner={partner} />
|
|
18
|
+
*
|
|
19
|
+
* // In Next.js (partner comes from query params automatically)
|
|
20
|
+
* <PartnerRegistrationWebComponent />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const PartnerRegistrationWebComponent: ({ partner: partnerProp }: PartnerRegistrationWebComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export { PartnerRegistrationWebComponent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UsePartnerRegistrationProps, UsePartnerRegistrationResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Hook for managing Partner SSO Registration.
|
|
5
|
+
* This hook is not exposed to package consumers.
|
|
6
|
+
*/
|
|
7
|
+
declare const usePartnerRegistration: ({ partner, token, path, }: UsePartnerRegistrationProps) => UsePartnerRegistrationResult;
|
|
8
|
+
export { usePartnerRegistration };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export interface PartnerRegistrationProps {
|
|
2
|
+
/**
|
|
3
|
+
* Called after successful registration
|
|
4
|
+
*/
|
|
5
|
+
onSuccess?: (data: PartnerRegistrationSuccessData) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Called when registration fails
|
|
8
|
+
*/
|
|
9
|
+
onError?: (error: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface PartnerRegistrationSuccessData {
|
|
12
|
+
token: string;
|
|
13
|
+
member: {
|
|
14
|
+
memberId: string;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
name: string;
|
|
18
|
+
email: string;
|
|
19
|
+
gender: string;
|
|
20
|
+
dateOfBirth: string;
|
|
21
|
+
clientId: number;
|
|
22
|
+
plan: number;
|
|
23
|
+
planExpiryDate: string | null;
|
|
24
|
+
};
|
|
25
|
+
redirectPath: string;
|
|
26
|
+
}
|
|
27
|
+
export interface UsePartnerRegistrationProps {
|
|
28
|
+
partner: string;
|
|
29
|
+
token: string;
|
|
30
|
+
path?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface UsePartnerRegistrationResult {
|
|
33
|
+
isLoading: boolean;
|
|
34
|
+
error: string | null;
|
|
35
|
+
tokenData: PartnerTokenData | null;
|
|
36
|
+
register: (formData: PartnerRegistrationFormData) => Promise<void>;
|
|
37
|
+
checkEmailExists: (email: string) => Promise<boolean>;
|
|
38
|
+
}
|
|
39
|
+
export interface PartnerTokenData {
|
|
40
|
+
partnerId?: number;
|
|
41
|
+
employeeId?: string;
|
|
42
|
+
firstName?: string;
|
|
43
|
+
lastName?: string;
|
|
44
|
+
gender?: 'M' | 'F';
|
|
45
|
+
dob?: string;
|
|
46
|
+
partnerMemberId?: string;
|
|
47
|
+
entityId?: string;
|
|
48
|
+
email?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface PartnerRegistrationFormData {
|
|
51
|
+
email: string;
|
|
52
|
+
countryCode: string;
|
|
53
|
+
mobile: string;
|
|
54
|
+
firstName: string;
|
|
55
|
+
lastName: string;
|
|
56
|
+
gender: 'M' | 'F';
|
|
57
|
+
dateOfBirth: string;
|
|
58
|
+
}
|
|
59
|
+
export interface Country {
|
|
60
|
+
countryCode: string;
|
|
61
|
+
phoneCode: string;
|
|
62
|
+
name: string;
|
|
63
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ProfileData } from '../../types';
|
|
2
|
+
declare const useProfile: () => {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
profile: import("../../../..").MemberProfile | null;
|
|
5
|
+
profileData: ProfileData;
|
|
6
|
+
imageUrl: string;
|
|
7
|
+
setImageUrl: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
8
|
+
updateProfile: (data: {
|
|
9
|
+
firstName: string;
|
|
10
|
+
lastName: string;
|
|
11
|
+
bio?: string;
|
|
12
|
+
image?: string;
|
|
13
|
+
}, onSuccess?: () => void) => Promise<void>;
|
|
14
|
+
uploadProfileImage: (file: File) => Promise<string | null>;
|
|
15
|
+
updateMobileNumber: (data: {
|
|
16
|
+
countryCode: string;
|
|
17
|
+
mobileNo: string;
|
|
18
|
+
}, onSuccess?: () => void, onFailure?: () => void) => Promise<void>;
|
|
19
|
+
sendMobileOtp: (onSuccess?: () => void, onFailure?: () => void) => Promise<void>;
|
|
20
|
+
verifyMobileOtp: (otp: string, onSuccess?: () => void, onFailure?: () => void) => Promise<void>;
|
|
21
|
+
changePassword: (data: {
|
|
22
|
+
currentPassword: string;
|
|
23
|
+
newPassword: string;
|
|
24
|
+
}, onSuccess?: () => void, onFailure?: (error?: string) => void) => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
export { useProfile };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ProfileWebComponent } from './components/ProfileWebComponent';
|
|
2
|
+
export { EditProfile } from './components/EditProfile';
|
|
3
|
+
export { EditMobileNumber } from './components/EditMobileNumber';
|
|
4
|
+
export { EditPassword } from './components/EditPassword';
|
|
5
|
+
export { OtpVerificationModal } from './components/OtpVerificationModal';
|
|
6
|
+
export { useProfile } from './hooks/internal/useProfile';
|
|
7
|
+
export type * from './types';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ProfileWebComponent } from './components/ProfileWebComponent/index.native';
|
|
2
|
+
export { EditProfile } from './components/EditProfile/index.native';
|
|
3
|
+
export { EditMobileNumber } from './components/EditMobileNumber/index.native';
|
|
4
|
+
export { EditPassword } from './components/EditPassword/index.native';
|
|
5
|
+
export { OtpVerificationModal } from './components/OtpVerificationModal/index.native';
|
|
6
|
+
export { useProfile } from './hooks/internal/useProfile';
|
|
7
|
+
export type * from './types';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
interface ProfileData {
|
|
3
|
+
firstName: string;
|
|
4
|
+
lastName: string;
|
|
5
|
+
dateOfBirth: Date | string;
|
|
6
|
+
gender: string;
|
|
7
|
+
bio?: string;
|
|
8
|
+
image?: string;
|
|
9
|
+
phone?: string;
|
|
10
|
+
countryCode?: string;
|
|
11
|
+
}
|
|
12
|
+
interface EditProfileProps {
|
|
13
|
+
profileData: ProfileData;
|
|
14
|
+
imageUrl?: string;
|
|
15
|
+
setImageUrl: React.Dispatch<React.SetStateAction<string>>;
|
|
16
|
+
editProfileForm: any;
|
|
17
|
+
onSuccess?: () => void;
|
|
18
|
+
}
|
|
19
|
+
interface EditMobileNumberProps {
|
|
20
|
+
countryCode?: string;
|
|
21
|
+
editPhoneForm: any;
|
|
22
|
+
onSuccess?: () => void;
|
|
23
|
+
}
|
|
24
|
+
interface EditPasswordProps {
|
|
25
|
+
editPasswordForm: any;
|
|
26
|
+
onSuccess?: () => void;
|
|
27
|
+
}
|
|
28
|
+
interface OtpVerificationModalProps {
|
|
29
|
+
open: boolean;
|
|
30
|
+
onOpenChange: (open: boolean) => void;
|
|
31
|
+
phone: string;
|
|
32
|
+
countryCode?: string;
|
|
33
|
+
onSuccess?: () => void;
|
|
34
|
+
successMessage?: string;
|
|
35
|
+
title?: string | React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
interface ProfileWebComponentProps {
|
|
38
|
+
/** Optional header component to wrap the profile content */
|
|
39
|
+
HeaderComponent?: React.ComponentType<{
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
}>;
|
|
42
|
+
/** Optional footer component */
|
|
43
|
+
FooterComponent?: React.ComponentType;
|
|
44
|
+
/** Callback when profile is updated successfully */
|
|
45
|
+
onProfileUpdate?: () => void;
|
|
46
|
+
/** Callback when mobile number is updated successfully */
|
|
47
|
+
onMobileUpdate?: () => void;
|
|
48
|
+
/** Callback when password is updated successfully */
|
|
49
|
+
onPasswordUpdate?: () => void;
|
|
50
|
+
/** Custom container className */
|
|
51
|
+
containerClassName?: string;
|
|
52
|
+
}
|
|
53
|
+
export type { ProfileData, EditProfileProps, EditMobileNumberProps, EditPasswordProps, OtpVerificationModalProps, ProfileWebComponentProps };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Client } from "../../../types/types";
|
|
2
|
+
type AuthMethod = 'oidc' | 'saml';
|
|
2
3
|
interface SSOInitiationData {
|
|
3
4
|
clientId: number;
|
|
4
5
|
authenticationUrl: string;
|
|
5
|
-
redirectUri
|
|
6
|
+
redirectUri?: string;
|
|
7
|
+
authMethod: AuthMethod;
|
|
6
8
|
}
|
|
7
9
|
interface SSOAuthenticationMethodsProps {
|
|
8
10
|
client: Client;
|
|
9
11
|
onPressBack: () => void;
|
|
10
12
|
handleMobileLogin: () => void;
|
|
11
13
|
}
|
|
12
|
-
export type { SSOAuthenticationMethodsProps, SSOInitiationData };
|
|
14
|
+
export type { SSOAuthenticationMethodsProps, SSOInitiationData, AuthMethod };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AuthMethod } from '../../../AuthenticationMethods/types';
|
|
2
|
+
interface SSOCallbackComponentsProps {
|
|
3
|
+
authMethodOverride?: AuthMethod;
|
|
4
|
+
}
|
|
5
|
+
declare const SSOCallbackComponents: ({ authMethodOverride }?: SSOCallbackComponentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
6
|
export { SSOCallbackComponents };
|
|
@@ -3,8 +3,12 @@ import type { useSSOCallbackProps, SignUpData } from "../../types";
|
|
|
3
3
|
* @internal
|
|
4
4
|
* Hook for managing SSOCallback screen state and auth context integration.
|
|
5
5
|
* This hook is not exposed to package consumers.
|
|
6
|
+
*
|
|
7
|
+
* Supports both OIDC and SAML flows:
|
|
8
|
+
* - OIDC: Calls /callback endpoint with authorization code
|
|
9
|
+
* - SAML: Calls /saml-sso-complete endpoint with exchange code
|
|
6
10
|
*/
|
|
7
|
-
declare const useSSOCallback: ({ clientId, code }: useSSOCallbackProps) => {
|
|
11
|
+
declare const useSSOCallback: ({ clientId, code, authMethod, isReady }: useSSOCallbackProps) => {
|
|
8
12
|
result: SignUpData | null;
|
|
9
13
|
error: string | null;
|
|
10
14
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuthMethod } from '../AuthenticationMethods/types';
|
|
1
2
|
interface SignUpData {
|
|
2
3
|
email: string;
|
|
3
4
|
firstName: string;
|
|
@@ -7,5 +8,7 @@ interface SignUpData {
|
|
|
7
8
|
interface useSSOCallbackProps {
|
|
8
9
|
code?: string;
|
|
9
10
|
clientId: number | string;
|
|
11
|
+
authMethod?: AuthMethod;
|
|
12
|
+
isReady?: boolean;
|
|
10
13
|
}
|
|
11
14
|
export type { useSSOCallbackProps, SignUpData };
|
package/get-metro-config.js
CHANGED
|
@@ -1,40 +1,33 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
|
-
const escape = require("escape-string-regexp")
|
|
3
|
-
const exclusionList = require("metro-config/src/defaults/exclusionList")
|
|
4
|
-
|
|
5
|
-
// normalize to POSIX style so we control slashes consistently
|
|
6
|
-
const toPosix = (p) => p.replace(/\\/g, "/");
|
|
2
|
+
const escape = require("escape-string-regexp")
|
|
3
|
+
const exclusionList = require("metro-config/src/defaults/exclusionList")
|
|
7
4
|
|
|
8
5
|
const getMetroConfig = (dirPath, packagePath) => {
|
|
9
|
-
const packageDir = path.resolve(dirPath, packagePath)
|
|
10
|
-
const packageJson = require(path.resolve(packageDir,
|
|
11
|
-
const packagePeerDeps = Object.keys(packageJson.peerDependencies || {})
|
|
6
|
+
const packageDir = path.resolve(dirPath, packagePath)
|
|
7
|
+
const packageJson = require(path.resolve(packageDir, 'package.json'))
|
|
8
|
+
const packagePeerDeps = Object.keys(packageJson.peerDependencies || {})
|
|
12
9
|
|
|
13
|
-
console.log(
|
|
14
|
-
console.log(
|
|
15
|
-
console.log(
|
|
16
|
-
console.log(
|
|
10
|
+
console.log('====================================');
|
|
11
|
+
console.log('Watching:', packageJson['name']);
|
|
12
|
+
console.log('PeerDeps:', packagePeerDeps);
|
|
13
|
+
console.log('====================================');
|
|
17
14
|
|
|
18
15
|
return {
|
|
19
16
|
watchFolders: [packageDir],
|
|
20
17
|
resolver: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// After base, allow either "/" or "\" via a non-capturing group
|
|
27
|
-
const pattern = `^${escape(base)}(?:/|\\\\).*$`;
|
|
28
|
-
return new RegExp(pattern);
|
|
29
|
-
})
|
|
18
|
+
blacklistRE: exclusionList(
|
|
19
|
+
packagePeerDeps.map(
|
|
20
|
+
(peerDep) =>
|
|
21
|
+
new RegExp(`^${escape(path.join(packageDir, 'node_modules', peerDep))}\\/.*$`)
|
|
22
|
+
)
|
|
30
23
|
),
|
|
31
24
|
|
|
32
25
|
extraNodeModules: packagePeerDeps.reduce((acc, name) => {
|
|
33
|
-
acc[name] = path.join(dirPath,
|
|
26
|
+
acc[name] = path.join(dirPath, 'node_modules', name);
|
|
34
27
|
return acc;
|
|
35
28
|
}, {}),
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
39
32
|
|
|
40
|
-
module.exports = { getMetroConfig }
|
|
33
|
+
module.exports = { getMetroConfig }
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"description": "Truworth Auth Package for React Native and Web",
|
|
7
|
-
"version": "1.2.12-beta.
|
|
7
|
+
"version": "1.2.12-beta.2",
|
|
8
8
|
"main": "build/src/index.js",
|
|
9
9
|
"types": "build/types/index.d.ts",
|
|
10
10
|
"files": [
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@react-native-google-signin/google-signin": "12.2.1",
|
|
27
27
|
"@react-navigation/native": "7.1.17",
|
|
28
28
|
"@react-navigation/native-stack": "7.3.26",
|
|
29
|
-
"@truworth/twc-rn-common": "1.1.3-beta.
|
|
30
|
-
"@truworth/twc-web-design": "1.
|
|
29
|
+
"@truworth/twc-rn-common": "1.1.3-beta.8",
|
|
30
|
+
"@truworth/twc-web-design": "2.1.0",
|
|
31
31
|
"@twotalltotems/react-native-otp-input": "1.3.11",
|
|
32
32
|
"@types/lodash": "^4.17.15",
|
|
33
33
|
"@types/react": "^18.2.0",
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"copyfiles": "^2.4.1",
|
|
40
40
|
"crypto-js": "^4.2.0",
|
|
41
41
|
"del-cli": "^6.0.0",
|
|
42
|
+
"jwt-decode": "^4.0.0",
|
|
42
43
|
"lottie-react": "^2.4.1",
|
|
43
44
|
"lottie-react-native": "7.2.4",
|
|
44
45
|
"moment": "^2.30.1",
|
|
45
|
-
"next": "15.5.10",
|
|
46
46
|
"react": "19.1.0",
|
|
47
|
-
"react-native": "0.80.2",
|
|
48
47
|
"react-dom": "^19.1.0",
|
|
49
48
|
"react-google-login": "^5.2.2",
|
|
50
49
|
"react-google-recaptcha": "^3.1.0",
|
|
51
50
|
"react-infinite-scroll-component": "^6.1.0",
|
|
52
51
|
"react-lottie": "^1.2.3",
|
|
52
|
+
"react-native": "0.80.2",
|
|
53
53
|
"react-native-fast-image": "8.6.3",
|
|
54
54
|
"react-native-fbsdk-next": "13.4.1",
|
|
55
55
|
"react-native-linear-gradient": "2.8.3",
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
"lodash": ">=4.17.21",
|
|
79
79
|
"lottie-react-native": ">=6.7.2",
|
|
80
80
|
"lucide-react": ">=0.483.0",
|
|
81
|
-
"next": ">=13.4.19",
|
|
82
81
|
"react": ">=18.2.0",
|
|
83
82
|
"react-dom": ">=18.2.0",
|
|
84
83
|
"react-native": ">=0.74.5",
|