@asgardeo/react 0.3.0 → 0.4.0
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 +5 -1
- package/dist/AsgardeoReactClient.d.ts +3 -2
- package/dist/__temp__/api.d.ts +17 -18
- package/dist/__temp__/models.d.ts +13 -21
- package/dist/cjs/index.js +17252 -1209
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +4 -3
- package/dist/components/actions/SignInButton/SignInButton.d.ts +21 -2
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +4 -3
- package/dist/components/actions/SignOutButton/SignOutButton.d.ts +22 -1
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +2 -1
- package/dist/components/actions/SignUpButton/SignUpButton.d.ts +21 -0
- package/dist/components/factories/FieldFactory.d.ts +107 -0
- package/dist/components/presentation/SignIn/BaseSignIn.d.ts +125 -0
- package/dist/components/presentation/SignIn/SignIn.d.ts +62 -0
- package/dist/components/presentation/SignIn/options/EmailOtp.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/FacebookButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/GitHubButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/GoogleButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/IdentifierFirst.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/LinkedInButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/MicrosoftButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/MultiOptionButton.d.ts +26 -0
- package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +76 -0
- package/dist/components/presentation/SignIn/options/SignInWithEthereumButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/SmsOtp.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/SocialButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/Totp.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/UsernamePassword.d.ts +25 -0
- package/dist/components/presentation/SignIn/types.d.ts +124 -0
- package/dist/components/presentation/User/BaseUser.d.ts +66 -0
- package/dist/components/presentation/{User.d.ts → User/User.d.ts} +9 -4
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +23 -2
- package/dist/components/primitives/Alert/Alert.d.ts +74 -0
- package/dist/components/primitives/Button/Button.d.ts +83 -0
- package/dist/components/primitives/Card/Card.d.ts +133 -0
- package/dist/components/primitives/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/primitives/Divider/Divider.d.ts +58 -0
- package/dist/components/primitives/FormControl/FormControl.d.ts +50 -0
- package/dist/components/primitives/Icons/CircleAlert.d.ts +23 -0
- package/dist/components/primitives/Icons/CircleCheck.d.ts +23 -0
- package/dist/components/primitives/Icons/Eye.d.ts +23 -0
- package/dist/components/primitives/Icons/EyeOff.d.ts +23 -0
- package/dist/components/primitives/Icons/Info.d.ts +23 -0
- package/dist/components/primitives/Icons/TriangleAlert.d.ts +23 -0
- package/dist/components/primitives/InputLabel/InputLabel.d.ts +46 -0
- package/dist/components/primitives/OtpField/OtpField.d.ts +86 -0
- package/dist/components/primitives/PasswordField/PasswordField.d.ts +31 -0
- package/dist/components/primitives/Popover/Popover.d.ts +71 -34
- package/dist/components/primitives/Select/Select.d.ts +1 -1
- package/dist/components/primitives/Spinner/Spinner.d.ts +54 -0
- package/dist/components/primitives/TextField/TextField.d.ts +18 -2
- package/dist/components/primitives/Typography/Typography.d.ts +81 -0
- package/dist/contexts/{AsgardeoContext.d.ts → Asgardeo/AsgardeoContext.d.ts} +1 -0
- package/dist/{providers → contexts/Asgardeo}/AsgardeoProvider.d.ts +1 -1
- package/dist/{hooks → contexts/Asgardeo}/useAsgardeo.d.ts +1 -1
- package/dist/contexts/Flow/FlowContext.d.ts +73 -0
- package/dist/contexts/Flow/FlowProvider.d.ts +46 -0
- package/dist/contexts/Flow/useFlow.d.ts +48 -0
- package/dist/contexts/I18n/I18nContext.d.ts +42 -0
- package/dist/contexts/I18n/I18nProvider.d.ts +31 -0
- package/dist/contexts/I18n/useI18n.d.ts +27 -0
- package/dist/{theme → contexts/Theme}/ThemeProvider.d.ts +2 -1
- package/dist/{theme → contexts/Theme}/useTheme.d.ts +2 -1
- package/dist/contexts/User/UserContext.d.ts +32 -0
- package/dist/contexts/User/UserProvider.d.ts +55 -0
- package/dist/contexts/User/useUser.d.ts +94 -0
- package/dist/hooks/useForm.d.ts +192 -0
- package/dist/hooks/useTranslation.d.ts +52 -0
- package/dist/index.d.ts +94 -9
- package/dist/index.js +17242 -1113
- package/dist/index.js.map +4 -4
- package/dist/utils/getMappedUserProfileValue.d.ts +33 -1
- package/package.json +6 -5
- package/dist/utils/getUserProfile.d.ts +0 -59
- /package/dist/{theme → contexts/Theme}/ThemeContext.d.ts +0 -0
- /package/dist/{theme → contexts/Theme}/types.d.ts +0 -0
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { ButtonHTMLAttributes, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
import { WithPreferences } from '@asgardeo/browser';
|
|
19
20
|
/**
|
|
20
21
|
* Common props shared by all {@link BaseSignInButton} components.
|
|
21
22
|
*/
|
|
@@ -23,7 +24,7 @@ export interface CommonBaseSignInButtonProps {
|
|
|
23
24
|
/**
|
|
24
25
|
* Function to initiate the sign-in process
|
|
25
26
|
*/
|
|
26
|
-
signIn
|
|
27
|
+
signIn: () => Promise<void>;
|
|
27
28
|
/**
|
|
28
29
|
* Loading state during sign-in process
|
|
29
30
|
*/
|
|
@@ -36,7 +37,7 @@ export type BaseSignInButtonRenderProps = CommonBaseSignInButtonProps;
|
|
|
36
37
|
/**
|
|
37
38
|
* Props interface of {@link BaseSignInButton}
|
|
38
39
|
*/
|
|
39
|
-
export interface BaseSignInButtonProps extends CommonBaseSignInButtonProps
|
|
40
|
+
export interface BaseSignInButtonProps extends Partial<CommonBaseSignInButtonProps>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
|
|
40
41
|
/**
|
|
41
42
|
* Render prop function that receives sign-in props, or traditional ReactNode children
|
|
42
43
|
*/
|
|
@@ -48,7 +49,7 @@ export interface BaseSignInButtonProps extends CommonBaseSignInButtonProps, Omit
|
|
|
48
49
|
* @example Using render props
|
|
49
50
|
* ```tsx
|
|
50
51
|
* <BaseSignInButton>
|
|
51
|
-
* {({
|
|
52
|
+
* {({signIn, isLoading}) => (
|
|
52
53
|
* <button onClick={signIn} disabled={isLoading}>
|
|
53
54
|
* {isLoading ? 'Signing in...' : 'Sign In'}
|
|
54
55
|
* </button>
|
|
@@ -29,8 +29,8 @@ export type SignInButtonProps = BaseSignInButtonProps;
|
|
|
29
29
|
* @example Using render props
|
|
30
30
|
* ```tsx
|
|
31
31
|
* <SignInButton>
|
|
32
|
-
* {({
|
|
33
|
-
* <button onClick={
|
|
32
|
+
* {({signIn, isLoading}) => (
|
|
33
|
+
* <button onClick={signIn} disabled={isLoading}>
|
|
34
34
|
* {isLoading ? 'Signing in...' : 'Sign In'}
|
|
35
35
|
* </button>
|
|
36
36
|
* )}
|
|
@@ -41,6 +41,25 @@ export type SignInButtonProps = BaseSignInButtonProps;
|
|
|
41
41
|
* ```tsx
|
|
42
42
|
* <SignInButton className="custom-button">Sign In</SignInButton>
|
|
43
43
|
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example Using component-level preferences
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <SignInButton
|
|
48
|
+
* preferences={{
|
|
49
|
+
* i18n: {
|
|
50
|
+
* bundles: {
|
|
51
|
+
* 'en-US': {
|
|
52
|
+
* translations: {
|
|
53
|
+
* 'buttons.signIn': 'Custom Sign In Text'
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
* }}
|
|
59
|
+
* >
|
|
60
|
+
* Custom Sign In
|
|
61
|
+
* </SignInButton>
|
|
62
|
+
* ```
|
|
44
63
|
*/
|
|
45
64
|
declare const SignInButton: ForwardRefExoticComponent<SignInButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
46
65
|
export default SignInButton;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
import { WithPreferences } from '@asgardeo/browser';
|
|
19
20
|
/**
|
|
20
21
|
* Common props shared by all {@link BaseSignOutButton} components.
|
|
21
22
|
*/
|
|
@@ -23,7 +24,7 @@ export interface CommonBaseSignOutButtonProps {
|
|
|
23
24
|
/**
|
|
24
25
|
* Function to initiate the sign-out process
|
|
25
26
|
*/
|
|
26
|
-
signOut
|
|
27
|
+
signOut: () => Promise<void>;
|
|
27
28
|
/**
|
|
28
29
|
* Loading state during sign-out process
|
|
29
30
|
*/
|
|
@@ -36,7 +37,7 @@ export type BaseSignOutButtonRenderProps = CommonBaseSignOutButtonProps;
|
|
|
36
37
|
/**
|
|
37
38
|
* Props interface of {@link BaseSignOutButton}
|
|
38
39
|
*/
|
|
39
|
-
export interface BaseSignOutButtonProps extends CommonBaseSignOutButtonProps
|
|
40
|
+
export interface BaseSignOutButtonProps extends Partial<CommonBaseSignOutButtonProps>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
|
|
40
41
|
/**
|
|
41
42
|
* Render prop function that receives sign-out props, or traditional ReactNode children
|
|
42
43
|
*/
|
|
@@ -48,7 +49,7 @@ export interface BaseSignOutButtonProps extends CommonBaseSignOutButtonProps, Om
|
|
|
48
49
|
* @example Using render props
|
|
49
50
|
* ```tsx
|
|
50
51
|
* <BaseSignOutButton>
|
|
51
|
-
* {({
|
|
52
|
+
* {({signOut, isLoading}) => (
|
|
52
53
|
* <button onClick={signOut} disabled={isLoading}>
|
|
53
54
|
* {isLoading ? 'Signing out...' : 'Sign Out'}
|
|
54
55
|
* </button>
|
|
@@ -24,10 +24,12 @@ export type SignOutButtonProps = BaseSignOutButtonProps;
|
|
|
24
24
|
/**
|
|
25
25
|
* SignOutButton component that supports both render props and traditional props patterns.
|
|
26
26
|
*
|
|
27
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
28
|
+
*
|
|
27
29
|
* @example Using render props pattern
|
|
28
30
|
* ```tsx
|
|
29
31
|
* <SignOutButton>
|
|
30
|
-
* {({
|
|
32
|
+
* {({signOut, isLoading}) => (
|
|
31
33
|
* <button onClick={signOut} disabled={isLoading}>
|
|
32
34
|
* {isLoading ? 'Signing out...' : 'Sign Out'}
|
|
33
35
|
* </button>
|
|
@@ -39,6 +41,25 @@ export type SignOutButtonProps = BaseSignOutButtonProps;
|
|
|
39
41
|
* ```tsx
|
|
40
42
|
* <SignOutButton className="custom-button">Sign Out</SignOutButton>
|
|
41
43
|
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example Using component-level preferences
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <SignOutButton
|
|
48
|
+
* preferences={{
|
|
49
|
+
* i18n: {
|
|
50
|
+
* bundles: {
|
|
51
|
+
* 'en-US': {
|
|
52
|
+
* translations: {
|
|
53
|
+
* 'buttons.signOut': 'Custom Sign Out Text'
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
* }}
|
|
59
|
+
* >
|
|
60
|
+
* Custom Sign Out
|
|
61
|
+
* </SignOutButton>
|
|
62
|
+
* ```
|
|
42
63
|
*/
|
|
43
64
|
declare const SignOutButton: ForwardRefExoticComponent<SignOutButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
44
65
|
export default SignOutButton;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { ForwardRefExoticComponent, ButtonHTMLAttributes, ReactNode, RefAttributes } from 'react';
|
|
19
|
+
import { WithPreferences } from '@asgardeo/browser';
|
|
19
20
|
/**
|
|
20
21
|
* Common props shared by all {@link BaseSignUpButton} components.
|
|
21
22
|
*/
|
|
@@ -36,7 +37,7 @@ export type BaseSignUpButtonRenderProps = CommonBaseSignUpButtonProps;
|
|
|
36
37
|
/**
|
|
37
38
|
* Props interface of {@link BaseSignUpButton}
|
|
38
39
|
*/
|
|
39
|
-
export interface BaseSignUpButtonProps extends CommonBaseSignUpButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'
|
|
40
|
+
export interface BaseSignUpButtonProps extends CommonBaseSignUpButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, WithPreferences {
|
|
40
41
|
/**
|
|
41
42
|
* Render prop function that receives sign-up props, or traditional ReactNode children
|
|
42
43
|
*/
|
|
@@ -25,6 +25,8 @@ export type SignUpButtonProps = BaseSignUpButtonProps;
|
|
|
25
25
|
* SignUpButton component that supports both render props and traditional props patterns.
|
|
26
26
|
* It redirects the user to the Asgardeo sign-up page configured for the application.
|
|
27
27
|
*
|
|
28
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
29
|
+
*
|
|
28
30
|
* @example Using render props pattern
|
|
29
31
|
* ```tsx
|
|
30
32
|
* <SignUpButton>
|
|
@@ -40,6 +42,25 @@ export type SignUpButtonProps = BaseSignUpButtonProps;
|
|
|
40
42
|
* ```tsx
|
|
41
43
|
* <SignUpButton className="custom-button">Create Account</SignUpButton>
|
|
42
44
|
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Using component-level preferences
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <SignUpButton
|
|
49
|
+
* preferences={{
|
|
50
|
+
* i18n: {
|
|
51
|
+
* bundles: {
|
|
52
|
+
* 'en-US': {
|
|
53
|
+
* translations: {
|
|
54
|
+
* 'buttons.signUp': 'Custom Sign Up Text'
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
* }}
|
|
60
|
+
* >
|
|
61
|
+
* Custom Sign Up
|
|
62
|
+
* </SignUpButton>
|
|
63
|
+
* ```
|
|
43
64
|
*/
|
|
44
65
|
declare const SignUpButton: ForwardRefExoticComponent<SignUpButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
45
66
|
export default SignUpButton;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC, ReactElement } from 'react';
|
|
19
|
+
import { SelectOption } from '../primitives/Select/Select';
|
|
20
|
+
import { FieldType } from '@asgardeo/browser';
|
|
21
|
+
/**
|
|
22
|
+
* Interface for field configuration.
|
|
23
|
+
*/
|
|
24
|
+
export interface FieldConfig {
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* The field type based on ApplicationNativeAuthenticationAuthenticatorParamType.
|
|
28
|
+
*/
|
|
29
|
+
type: FieldType;
|
|
30
|
+
/**
|
|
31
|
+
* Display name for the field.
|
|
32
|
+
*/
|
|
33
|
+
label: string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the field is required.
|
|
36
|
+
*/
|
|
37
|
+
required: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Current value of the field.
|
|
40
|
+
*/
|
|
41
|
+
value: string;
|
|
42
|
+
/**
|
|
43
|
+
* Callback function when the field value changes.
|
|
44
|
+
*/
|
|
45
|
+
onChange: (value: string) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the field is disabled.
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Error message to display.
|
|
52
|
+
*/
|
|
53
|
+
error?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Additional CSS class name.
|
|
56
|
+
*/
|
|
57
|
+
className?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Additional options for multi-valued fields.
|
|
60
|
+
*/
|
|
61
|
+
options?: SelectOption[];
|
|
62
|
+
/**
|
|
63
|
+
* Whether the field has been touched/interacted with by the user.
|
|
64
|
+
*/
|
|
65
|
+
touched?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Placeholder text for the field.
|
|
68
|
+
*/
|
|
69
|
+
placeholder?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Utility function to parse multi-valued string into array
|
|
73
|
+
*/
|
|
74
|
+
export declare const parseMultiValuedString: (value: string) => string[];
|
|
75
|
+
/**
|
|
76
|
+
* Utility function to format array into multi-valued string
|
|
77
|
+
*/
|
|
78
|
+
export declare const formatMultiValuedString: (values: string[]) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Utility function to validate field values based on type
|
|
81
|
+
*/
|
|
82
|
+
export declare const validateFieldValue: (value: string, type: FieldType, required?: boolean, touched?: boolean) => string | null;
|
|
83
|
+
/**
|
|
84
|
+
* Factory function to create form fields based on the ApplicationNativeAuthenticationAuthenticatorParamType.
|
|
85
|
+
*
|
|
86
|
+
* @param config - The field configuration
|
|
87
|
+
* @returns The appropriate React component for the field type
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* const field = createField({
|
|
92
|
+
* param: 'username',
|
|
93
|
+
* type: ApplicationNativeAuthenticationAuthenticatorParamType.String,
|
|
94
|
+
* label: 'Username',
|
|
95
|
+
* confidential: false,
|
|
96
|
+
* required: true,
|
|
97
|
+
* value: '',
|
|
98
|
+
* onChange: (value) => console.log(value)
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare const createField: (config: FieldConfig) => ReactElement;
|
|
103
|
+
/**
|
|
104
|
+
* React component wrapper for the field factory.
|
|
105
|
+
*/
|
|
106
|
+
export declare const FieldFactory: FC<FieldConfig>;
|
|
107
|
+
export default FieldFactory;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { ApplicationNativeAuthenticationInitiateResponse, ApplicationNativeAuthenticationHandleResponse } from '@asgardeo/browser';
|
|
19
|
+
import { FC } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the BaseSignIn component.
|
|
22
|
+
*/
|
|
23
|
+
export interface BaseSignInProps {
|
|
24
|
+
/**
|
|
25
|
+
* Function to initialize authentication flow.
|
|
26
|
+
* @returns Promise resolving to the initial authentication response.
|
|
27
|
+
*/
|
|
28
|
+
onInitialize: () => Promise<ApplicationNativeAuthenticationInitiateResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Function to handle authentication steps.
|
|
31
|
+
* @param payload - The authentication payload.
|
|
32
|
+
* @returns Promise resolving to the authentication response.
|
|
33
|
+
*/
|
|
34
|
+
onSubmit: (flow: {
|
|
35
|
+
requestConfig?: {
|
|
36
|
+
method: string;
|
|
37
|
+
url: string;
|
|
38
|
+
};
|
|
39
|
+
payload: {
|
|
40
|
+
flowId: string;
|
|
41
|
+
selectedAuthenticator: {
|
|
42
|
+
authenticatorId: string;
|
|
43
|
+
params: Record<string, string>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}) => Promise<ApplicationNativeAuthenticationHandleResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Callback function called when authentication is successful.
|
|
49
|
+
* @param authData - The authentication data returned upon successful completion.
|
|
50
|
+
*/
|
|
51
|
+
onSuccess?: (authData: Record<string, any>) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Callback function called when authentication fails.
|
|
54
|
+
* @param error - The error that occurred during authentication.
|
|
55
|
+
*/
|
|
56
|
+
onError?: (error: Error) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Callback function called when authentication flow status changes.
|
|
59
|
+
* @param response - The current authentication response.
|
|
60
|
+
*/
|
|
61
|
+
onFlowChange?: (response: ApplicationNativeAuthenticationInitiateResponse | ApplicationNativeAuthenticationHandleResponse) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Custom CSS class name for the form container.
|
|
64
|
+
*/
|
|
65
|
+
className?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Custom CSS class name for form inputs.
|
|
68
|
+
*/
|
|
69
|
+
inputClassName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Custom CSS class name for the submit button.
|
|
72
|
+
*/
|
|
73
|
+
buttonClassName?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Custom CSS class name for error messages.
|
|
76
|
+
*/
|
|
77
|
+
errorClassName?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Custom CSS class name for info messages.
|
|
80
|
+
*/
|
|
81
|
+
messageClassName?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Size variant for the component.
|
|
84
|
+
*/
|
|
85
|
+
size?: 'small' | 'medium' | 'large';
|
|
86
|
+
/**
|
|
87
|
+
* Theme variant for the component.
|
|
88
|
+
*/
|
|
89
|
+
variant?: 'default' | 'outlined' | 'filled';
|
|
90
|
+
afterSignInUrl?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Base SignIn component that provides native authentication flow.
|
|
94
|
+
* This component handles both the presentation layer and authentication flow logic.
|
|
95
|
+
* It accepts API functions as props to maintain framework independence.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```tsx
|
|
99
|
+
* import { BaseSignIn } from '@asgardeo/react';
|
|
100
|
+
*
|
|
101
|
+
* const MySignIn = () => {
|
|
102
|
+
* return (
|
|
103
|
+
* <BaseSignIn
|
|
104
|
+
* onInitialize={async () => {
|
|
105
|
+
* // Your API call to initialize authentication
|
|
106
|
+
* return await initializeAuth();
|
|
107
|
+
* }}
|
|
108
|
+
* onSubmit={async (payload) => {
|
|
109
|
+
* // Your API call to handle authentication
|
|
110
|
+
* return await handleAuth(payload);
|
|
111
|
+
* }}
|
|
112
|
+
* onSuccess={(authData) => {
|
|
113
|
+
* console.log('Success:', authData);
|
|
114
|
+
* }}
|
|
115
|
+
* onError={(error) => {
|
|
116
|
+
* console.error('Error:', error);
|
|
117
|
+
* }}
|
|
118
|
+
* className="max-w-md mx-auto"
|
|
119
|
+
* />
|
|
120
|
+
* );
|
|
121
|
+
* };
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
declare const BaseSignIn: FC<BaseSignInProps>;
|
|
125
|
+
export default BaseSignIn;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* Props for the SignIn component.
|
|
21
|
+
*/
|
|
22
|
+
export interface SignInProps {
|
|
23
|
+
/**
|
|
24
|
+
* Additional CSS class names for customization.
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Size variant for the component.
|
|
29
|
+
*/
|
|
30
|
+
size?: 'small' | 'medium' | 'large';
|
|
31
|
+
/**
|
|
32
|
+
* Theme variant for the component.
|
|
33
|
+
*/
|
|
34
|
+
variant?: 'default' | 'outlined' | 'filled';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A styled SignIn component that provides native authentication flow with pre-built styling.
|
|
38
|
+
* This component handles the API calls for authentication and delegates UI logic to BaseSignIn.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* import { SignIn } from '@asgardeo/react';
|
|
43
|
+
*
|
|
44
|
+
* const App = () => {
|
|
45
|
+
* return (
|
|
46
|
+
* <SignIn
|
|
47
|
+
* onSuccess={(authData) => {
|
|
48
|
+
* console.log('Authentication successful:', authData);
|
|
49
|
+
* // Handle successful authentication (e.g., redirect, store tokens)
|
|
50
|
+
* }}
|
|
51
|
+
* onError={(error) => {
|
|
52
|
+
* console.error('Authentication failed:', error);
|
|
53
|
+
* }}
|
|
54
|
+
* size="medium"
|
|
55
|
+
* variant="outlined"
|
|
56
|
+
* />
|
|
57
|
+
* );
|
|
58
|
+
* };
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare const SignIn: FC<SignInProps>;
|
|
62
|
+
export default SignIn;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignInOptionProps } from './SignInOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Email OTP Sign-In Option Component.
|
|
22
|
+
* Handles email-based OTP authentication.
|
|
23
|
+
*/
|
|
24
|
+
declare const EmailOtp: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default EmailOtp;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignInOptionProps } from './SignInOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Facebook Sign-In Button Component.
|
|
22
|
+
* Handles authentication with Facebook identity provider.
|
|
23
|
+
*/
|
|
24
|
+
declare const FacebookButton: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default FacebookButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignInOptionProps } from './SignInOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* GitHub Sign-In Button Component.
|
|
22
|
+
* Handles authentication with GitHub identity provider.
|
|
23
|
+
*/
|
|
24
|
+
declare const GitHubButton: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default GitHubButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignInOptionProps } from './SignInOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Google Sign-In Button Component.
|
|
22
|
+
* Handles authentication with Google identity provider.
|
|
23
|
+
*/
|
|
24
|
+
declare const GoogleButton: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default GoogleButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignInOptionProps } from './SignInOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Identifier First Sign-In Option Component.
|
|
22
|
+
* Handles identifier-first authentication flow (username first, then password).
|
|
23
|
+
*/
|
|
24
|
+
declare const IdentifierFirst: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default IdentifierFirst;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignInOptionProps } from './SignInOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* LinkedIn Sign-In Button Component.
|
|
22
|
+
* Handles authentication with LinkedIn identity provider.
|
|
23
|
+
*/
|
|
24
|
+
declare const LinkedInButton: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default LinkedInButton;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignInOptionProps } from './SignInOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Microsoft Sign-In Button Component.
|
|
22
|
+
* Handles authentication with Microsoft identity provider.
|
|
23
|
+
*/
|
|
24
|
+
declare const MicrosoftButton: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default MicrosoftButton;
|