@truworth/twc-auth 1.2.5 → 1.2.7
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/email_icon.svg +6 -0
- package/build/src/constants/social-login-options.js +16 -0
- package/build/src/contexts/AuthContext.js +4 -2
- package/build/src/enums/index.js +1 -0
- package/build/src/enums/socialLogins.enum.js +6 -0
- package/build/src/helpers/{Network.js → network.js} +2 -2
- package/build/src/hooks/useRequest.js +1 -1
- package/build/src/screens/EnterEmail/hooks/internal/useEnterEmail.js +0 -1
- package/build/src/screens/EnterEmail/index.js +31 -3
- package/build/src/screens/EnterPassword/hooks/internal/useEnterPassword.js +19 -4
- package/build/src/screens/EnterPassword/index.js +27 -8
- package/build/src/screens/EnterPassword/index.native.js +10 -2
- package/build/src/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.js +22 -10
- package/build/src/screens/LoginWithEmailOTP/index.js +2 -2
- package/build/src/screens/LoginWithEmailOTP/index.native.js +2 -2
- package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.js +1 -1
- package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +11 -1
- package/build/src/screens/SignUp/hooks/internal/useSignUp.js +1 -1
- package/build/src/screens/SignUp/index.native.js +3 -0
- package/build/src/screens/UserConsent/hooks/internal/useConsent.js +10 -1
- package/build/src/screens/VerifyEmail/hooks/internal/useVerifyEmail.js +2 -2
- package/build/src/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.js +1 -1
- package/build/src/screens/Welcome/SocialAuth/commonSocialAuth.js +127 -0
- package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.js +191 -0
- package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.js +13 -0
- package/build/src/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.js +118 -0
- package/build/src/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.js +75 -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 +10 -5
- package/build/src/screens/Welcome/index.native.js +41 -4
- package/build/types/constants/social-login-options.d.ts +3 -0
- package/build/types/contexts/AuthContext.d.ts +2 -1
- package/build/types/contexts/type.d.ts +9 -0
- package/build/types/enums/index.d.ts +1 -0
- package/build/types/enums/socialLogins.enum.d.ts +5 -0
- package/build/types/helpers/types.d.ts +7 -1
- package/build/types/navigator/index.native.d.ts +6 -0
- package/build/types/screens/EnterEmail/hooks/internal/useEnterEmail.d.ts +0 -1
- package/build/types/screens/EnterPassword/hooks/internal/useEnterPassword.d.ts +5 -1
- package/build/types/screens/EnterPassword/types.d.ts +3 -0
- package/build/types/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.d.ts +4 -1
- package/build/types/screens/LoginWithEmailOTP/index.d.ts +4 -1
- 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 +8 -0
- package/build/types/types/types.d.ts +3 -0
- package/package.json +18 -16
- package/build/assets/okay_icon copy.svg +0 -3
- /package/build/src/helpers/{Validation.js → validation.js} +0 -0
- /package/build/types/helpers/{Network.d.ts → network.d.ts} +0 -0
- /package/build/types/helpers/{Validation.d.ts → validation.d.ts} +0 -0
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
type SubmitProps = {
|
|
2
2
|
email: string;
|
|
3
3
|
source: string;
|
|
4
|
+
verifyEmailOTP?: (params: {
|
|
5
|
+
mfaEnabled: boolean;
|
|
6
|
+
sessionToken: string;
|
|
7
|
+
}) => void;
|
|
4
8
|
};
|
|
5
9
|
/**
|
|
6
10
|
* @internal
|
|
@@ -12,7 +16,7 @@ declare const useEnterPassword: () => {
|
|
|
12
16
|
setPassword: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
13
17
|
isPasswordVisible: boolean;
|
|
14
18
|
togglePasswordVisibility: () => void;
|
|
15
|
-
handleSubmit: ({ email, source }: SubmitProps) => Promise<void>;
|
|
19
|
+
handleSubmit: ({ email, source, verifyEmailOTP }: SubmitProps) => Promise<void>;
|
|
16
20
|
isDisabled: boolean;
|
|
17
21
|
handlePasswordChange: (value: string) => void;
|
|
18
22
|
appName: string | undefined;
|
|
@@ -17,5 +17,8 @@ interface LoginWithEmailOTPModalProps {
|
|
|
17
17
|
show: boolean;
|
|
18
18
|
hide: () => void;
|
|
19
19
|
email: string;
|
|
20
|
+
password?: string;
|
|
21
|
+
sessionToken?: string;
|
|
22
|
+
mfaEnabled?: boolean;
|
|
20
23
|
}
|
|
21
24
|
export type { EnterPasswordProps, VerifyResetPasswordOTPModalProps, LoginWithEmailOTPModalProps };
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* @internal
|
|
3
3
|
* Hook for handling Email OTP Login flow.
|
|
4
4
|
*/
|
|
5
|
-
declare const useLoginWithEmailOTP: ({ email, source }: {
|
|
5
|
+
declare const useLoginWithEmailOTP: ({ email, password, source, sessionToken, mfaEnabled }: {
|
|
6
6
|
email: string;
|
|
7
|
+
password?: string;
|
|
7
8
|
source: string;
|
|
9
|
+
sessionToken?: string;
|
|
10
|
+
mfaEnabled?: boolean;
|
|
8
11
|
}) => {
|
|
9
12
|
sendOtp: () => void;
|
|
10
13
|
verifyOtp: (otp: string) => void;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
declare const LoginWithEmailOTP: ({ email }: {
|
|
1
|
+
declare const LoginWithEmailOTP: ({ email, password, sessionToken, mfaEnabled }: {
|
|
2
2
|
email: string;
|
|
3
|
+
password?: string;
|
|
4
|
+
sessionToken?: string;
|
|
5
|
+
mfaEnabled?: boolean;
|
|
3
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
4
7
|
export default LoginWithEmailOTP;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { MemberProfile } from "../../../types/types";
|
|
2
|
+
export declare enum SocialAuthStatus {
|
|
3
|
+
REGISTER = "REGISTER",
|
|
4
|
+
INVALID = "INVALID",
|
|
5
|
+
SUCCESS = "SUCCESS"
|
|
6
|
+
}
|
|
7
|
+
type Platform = "web" | "ios" | "android";
|
|
8
|
+
interface BaseSocialLoginParams {
|
|
9
|
+
email: string;
|
|
10
|
+
platform: Platform;
|
|
11
|
+
}
|
|
12
|
+
export interface GoogleLoginParams extends BaseSocialLoginParams {
|
|
13
|
+
googleIdentityToken: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FacebookLoginParams extends BaseSocialLoginParams {
|
|
16
|
+
facebookIdentityToken: string;
|
|
17
|
+
}
|
|
18
|
+
export interface AppleLoginParams extends BaseSocialLoginParams {
|
|
19
|
+
appleIdentityToken: string;
|
|
20
|
+
}
|
|
21
|
+
export type SocialAuthResult = {
|
|
22
|
+
status: SocialAuthStatus.REGISTER;
|
|
23
|
+
data: {
|
|
24
|
+
email: string;
|
|
25
|
+
};
|
|
26
|
+
} | {
|
|
27
|
+
status: SocialAuthStatus.INVALID;
|
|
28
|
+
data: {
|
|
29
|
+
existingLoginType?: string;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
status: SocialAuthStatus.SUCCESS;
|
|
33
|
+
data: {
|
|
34
|
+
token: string;
|
|
35
|
+
member: MemberProfile;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Handles Google authentication
|
|
40
|
+
*/
|
|
41
|
+
export declare const handleGoogleAuth: ({ email, googleIdentityToken, platform, }: GoogleLoginParams) => Promise<SocialAuthResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Handles Facebook authentication
|
|
44
|
+
*/
|
|
45
|
+
export declare const handleFacebookAuth: ({ email, facebookIdentityToken, platform }: FacebookLoginParams) => Promise<SocialAuthResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Handles Apple authentication
|
|
48
|
+
*/
|
|
49
|
+
export declare const handleAppleAuth: ({ email, appleIdentityToken, platform }: AppleLoginParams) => Promise<SocialAuthResult>;
|
|
50
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SocialLoginsEnum } from "../../../../enums";
|
|
1
2
|
/**
|
|
2
3
|
* @internal
|
|
3
4
|
* Hook for managing Welcome screen state and auth context integration.
|
|
@@ -8,7 +9,14 @@ declare const useWelcome: () => {
|
|
|
8
9
|
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
9
10
|
showSocialLoginModal: boolean;
|
|
10
11
|
setShowSocialLoginModal: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
12
|
+
socialLoginType: SocialLoginsEnum | undefined;
|
|
13
|
+
setSocialLoginType: import("react").Dispatch<import("react").SetStateAction<SocialLoginsEnum | undefined>>;
|
|
11
14
|
LogoComponent: import("react").ComponentType<{}> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
12
15
|
onLaunchAuthSession: (() => void) | undefined;
|
|
16
|
+
socialLoginConfig: Partial<Record<SocialLoginsEnum, {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
webClientId?: string;
|
|
19
|
+
}>> | undefined;
|
|
20
|
+
isSocialLoginEnabled: boolean;
|
|
13
21
|
};
|
|
14
22
|
export { useWelcome };
|
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.
|
|
7
|
+
"version": "1.2.7",
|
|
8
8
|
"main": "build/src/index.js",
|
|
9
9
|
"types": "build/types/index.d.ts",
|
|
10
10
|
"files": [
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
"pub": "git add . && git commit -m \"Updates\" && git push && npm run build && npm version patch && npm publish"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@invertase/react-native-apple-authentication": "
|
|
24
|
-
"@react-native-clipboard/clipboard": "1.
|
|
23
|
+
"@invertase/react-native-apple-authentication": "2.5.0",
|
|
24
|
+
"@react-native-clipboard/clipboard": "1.16.3",
|
|
25
25
|
"@react-native-community/datetimepicker": "8.1.1",
|
|
26
|
-
"@react-
|
|
27
|
-
"@react-navigation/native
|
|
28
|
-
"@
|
|
29
|
-
"@truworth/twc-
|
|
26
|
+
"@react-native-google-signin/google-signin": "12.2.1",
|
|
27
|
+
"@react-navigation/native": "6.1.17",
|
|
28
|
+
"@react-navigation/native-stack": "6.10.0",
|
|
29
|
+
"@truworth/twc-rn-common": "1.0.15",
|
|
30
|
+
"@truworth/twc-web-design": "1.11.0",
|
|
30
31
|
"@twotalltotems/react-native-otp-input": "1.3.11",
|
|
31
32
|
"@types/crypto-js": "^4.2.2",
|
|
32
33
|
"@types/fbemitter": "^2.0.35",
|
|
@@ -46,23 +47,24 @@
|
|
|
46
47
|
"lottie-react-native": "6.7.2",
|
|
47
48
|
"moment": "^2.30.1",
|
|
48
49
|
"next": "^15.0.4",
|
|
49
|
-
"react": "
|
|
50
|
+
"react": "18.3.1",
|
|
50
51
|
"react-dom": "^18.2.0",
|
|
52
|
+
"react-google-login": "^5.2.2",
|
|
51
53
|
"react-google-recaptcha": "^3.1.0",
|
|
52
54
|
"react-infinite-scroll-component": "^6.1.0",
|
|
53
55
|
"react-lottie": "^1.2.3",
|
|
54
|
-
"react-native": "
|
|
55
|
-
"react-native-fast-image": "
|
|
56
|
-
"react-native-fbsdk-next": "
|
|
57
|
-
"react-native-linear-gradient": "
|
|
56
|
+
"react-native": "0.76.1",
|
|
57
|
+
"react-native-fast-image": "8.6.3",
|
|
58
|
+
"react-native-fbsdk-next": "13.4.1",
|
|
59
|
+
"react-native-linear-gradient": "2.8.3",
|
|
58
60
|
"react-native-modalize": "2.1.1",
|
|
59
61
|
"react-native-parsed-text": "^0.0.22",
|
|
60
|
-
"react-native-reanimated": "
|
|
61
|
-
"react-native-rsa-native": "
|
|
62
|
-
"react-native-safe-area-context": "
|
|
62
|
+
"react-native-reanimated": "3.16.1",
|
|
63
|
+
"react-native-rsa-native": "2.0.5",
|
|
64
|
+
"react-native-safe-area-context": "4.14.0",
|
|
63
65
|
"react-native-svg": "15.8.0",
|
|
64
66
|
"react-native-svg-uri": "^1.2.3",
|
|
65
|
-
"react-native-vector-icons": "
|
|
67
|
+
"react-native-vector-icons": "9.2.0",
|
|
66
68
|
"react-redux": "^9.2.0",
|
|
67
69
|
"sweetalert2": "^11.23.0",
|
|
68
70
|
"typescript": "^5.0.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|