@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
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* Multi Option Button Component.
|
|
22
|
+
* Renders authenticators as selectable buttons for multi-option prompts.
|
|
23
|
+
* Used when authenticators don't require immediate user input but need to be selected first.
|
|
24
|
+
*/
|
|
25
|
+
declare const MultiOptionButton: FC<BaseSignInOptionProps>;
|
|
26
|
+
export default MultiOptionButton;
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { ApplicationNativeAuthenticationAuthenticator, WithPreferences } from '@asgardeo/browser';
|
|
19
|
+
import { ReactElement } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Base props that all sign-in option components share.
|
|
22
|
+
*/
|
|
23
|
+
export interface BaseSignInOptionProps extends WithPreferences {
|
|
24
|
+
/**
|
|
25
|
+
* The authenticator configuration.
|
|
26
|
+
*/
|
|
27
|
+
authenticator: ApplicationNativeAuthenticationAuthenticator;
|
|
28
|
+
/**
|
|
29
|
+
* Current form values.
|
|
30
|
+
*/
|
|
31
|
+
formValues: Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Touched state for form fields.
|
|
34
|
+
*/
|
|
35
|
+
touchedFields: Record<string, boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the component is in loading state.
|
|
38
|
+
*/
|
|
39
|
+
isLoading: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Error message to display.
|
|
42
|
+
*/
|
|
43
|
+
error?: string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Callback function called when input values change.
|
|
46
|
+
*/
|
|
47
|
+
onInputChange: (param: string, value: string) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Callback function called when the option is submitted.
|
|
50
|
+
*/
|
|
51
|
+
onSubmit: (authenticator: ApplicationNativeAuthenticationAuthenticator, formData?: Record<string, string>) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Custom CSS class name for form inputs.
|
|
54
|
+
*/
|
|
55
|
+
inputClassName?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Custom CSS class name for the submit button.
|
|
58
|
+
*/
|
|
59
|
+
buttonClassName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Text for the submit button.
|
|
62
|
+
*/
|
|
63
|
+
submitButtonText?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Creates the appropriate sign-in option component based on the authenticator's ID.
|
|
67
|
+
*/
|
|
68
|
+
export declare const createSignInOption: (props: BaseSignInOptionProps) => ReactElement;
|
|
69
|
+
/**
|
|
70
|
+
* Convenience function that creates the appropriate sign-in option component from an authenticator.
|
|
71
|
+
*/
|
|
72
|
+
export declare const createSignInOptionFromAuthenticator: (authenticator: ApplicationNativeAuthenticationAuthenticator, formValues: Record<string, string>, touchedFields: Record<string, boolean>, isLoading: boolean, onInputChange: (param: string, value: string) => void, onSubmit: (authenticator: ApplicationNativeAuthenticationAuthenticator, formData?: Record<string, string>) => void, options?: {
|
|
73
|
+
inputClassName?: string;
|
|
74
|
+
buttonClassName?: string;
|
|
75
|
+
error?: string | null;
|
|
76
|
+
}) => ReactElement;
|
|
@@ -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
|
+
* Sign In With Ethereum Button Component.
|
|
22
|
+
* Handles authentication with Sign In With Ethereum identity provider.
|
|
23
|
+
*/
|
|
24
|
+
declare const SignInWithEthereumButton: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default SignInWithEthereumButton;
|
|
@@ -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
|
+
* SMS OTP Sign-In Option Component.
|
|
22
|
+
* Handles SMS-based OTP authentication.
|
|
23
|
+
*/
|
|
24
|
+
declare const SmsOtp: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default SmsOtp;
|
|
@@ -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
|
+
* Social Login Sign-In Option Component.
|
|
22
|
+
* Handles authentication with external identity providers (Google, GitHub, etc.).
|
|
23
|
+
*/
|
|
24
|
+
declare const SocialLogin: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default SocialLogin;
|
|
@@ -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
|
+
* TOTP Sign-In Option Component.
|
|
22
|
+
* Handles Time-based One-Time Password (TOTP) authentication.
|
|
23
|
+
*/
|
|
24
|
+
declare const Totp: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default Totp;
|
|
@@ -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
|
+
* Username Password Sign-In Option Component.
|
|
22
|
+
* Handles traditional username and password authentication.
|
|
23
|
+
*/
|
|
24
|
+
declare const UsernamePassword: FC<BaseSignInOptionProps>;
|
|
25
|
+
export default UsernamePassword;
|
|
@@ -0,0 +1,124 @@
|
|
|
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 { ApplicationNativeAuthenticationAuthenticator, ApplicationNativeAuthenticationAuthenticatorParamType } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Interface for form field state.
|
|
21
|
+
*/
|
|
22
|
+
export interface FormField {
|
|
23
|
+
param: string;
|
|
24
|
+
type: ApplicationNativeAuthenticationAuthenticatorParamType;
|
|
25
|
+
displayName: string;
|
|
26
|
+
confidential: boolean;
|
|
27
|
+
required: boolean;
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Base props that all authenticator components share.
|
|
32
|
+
*/
|
|
33
|
+
export interface BaseAuthenticatorProps {
|
|
34
|
+
/**
|
|
35
|
+
* The authenticator configuration.
|
|
36
|
+
*/
|
|
37
|
+
authenticator: ApplicationNativeAuthenticationAuthenticator;
|
|
38
|
+
/**
|
|
39
|
+
* Current form values.
|
|
40
|
+
*/
|
|
41
|
+
formValues: Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the component is in loading state.
|
|
44
|
+
*/
|
|
45
|
+
isLoading: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Error message to display.
|
|
48
|
+
*/
|
|
49
|
+
error?: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Callback function called when input values change.
|
|
52
|
+
*/
|
|
53
|
+
onInputChange: (param: string, value: string) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Callback function called when the authenticator is submitted.
|
|
56
|
+
*/
|
|
57
|
+
onSubmit: (authenticator: ApplicationNativeAuthenticationAuthenticator, formData?: Record<string, string>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Custom CSS class name for form inputs.
|
|
60
|
+
*/
|
|
61
|
+
inputClassName?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Custom CSS class name for the submit button.
|
|
64
|
+
*/
|
|
65
|
+
buttonClassName?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Text for the submit button.
|
|
68
|
+
*/
|
|
69
|
+
submitButtonText?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Props for authenticator selector component.
|
|
73
|
+
*/
|
|
74
|
+
export interface AuthenticatorSelectorProps {
|
|
75
|
+
/**
|
|
76
|
+
* Available authenticators for selection.
|
|
77
|
+
*/
|
|
78
|
+
authenticators: ApplicationNativeAuthenticationAuthenticator[];
|
|
79
|
+
/**
|
|
80
|
+
* Current form values.
|
|
81
|
+
*/
|
|
82
|
+
formValues: Record<string, string>;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the component is in loading state.
|
|
85
|
+
*/
|
|
86
|
+
isLoading: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Error message to display.
|
|
89
|
+
*/
|
|
90
|
+
error?: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Messages to display to the user.
|
|
93
|
+
*/
|
|
94
|
+
messages: Array<{
|
|
95
|
+
type: string;
|
|
96
|
+
message: string;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Callback function called when input values change.
|
|
100
|
+
*/
|
|
101
|
+
onInputChange: (param: string, value: string) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Callback function called when an authenticator is selected.
|
|
104
|
+
*/
|
|
105
|
+
onAuthenticatorSelection: (authenticator: ApplicationNativeAuthenticationAuthenticator, formData?: Record<string, string>) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Custom CSS class names.
|
|
108
|
+
*/
|
|
109
|
+
inputClassName?: string;
|
|
110
|
+
buttonClassName?: string;
|
|
111
|
+
errorClassName?: string;
|
|
112
|
+
messageClassName?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Text for the submit button.
|
|
115
|
+
*/
|
|
116
|
+
submitButtonText?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Style configuration for authenticators.
|
|
120
|
+
*/
|
|
121
|
+
export interface AuthenticatorStyle {
|
|
122
|
+
variant: 'solid' | 'outline';
|
|
123
|
+
color: string;
|
|
124
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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 { User as IUser } from '@asgardeo/browser';
|
|
19
|
+
import { FC, ReactNode } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the BaseUser component.
|
|
22
|
+
*/
|
|
23
|
+
export interface BaseUserProps {
|
|
24
|
+
/**
|
|
25
|
+
* The user object to display. If not provided, the component will render the fallback.
|
|
26
|
+
*/
|
|
27
|
+
user: IUser | null;
|
|
28
|
+
/**
|
|
29
|
+
* Render prop that takes the user object and returns a ReactNode.
|
|
30
|
+
* @param user - The authenticated user object from Asgardeo.
|
|
31
|
+
* @returns A ReactNode to render.
|
|
32
|
+
*/
|
|
33
|
+
children: (user: IUser | null) => ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Optional element to render when no user is provided.
|
|
36
|
+
*/
|
|
37
|
+
fallback?: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Base User component that provides the core functionality for displaying user information.
|
|
41
|
+
* This component takes a user object as a prop and uses render props to expose it.
|
|
42
|
+
*
|
|
43
|
+
* @remarks This is the base component that can be used in any context where you have
|
|
44
|
+
* a user object available. For React applications, use the User component which
|
|
45
|
+
* automatically retrieves the user from Asgardeo context.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* import { BaseUser } from '@asgardeo/auth-react';
|
|
50
|
+
*
|
|
51
|
+
* const MyComponent = ({ user }) => {
|
|
52
|
+
* return (
|
|
53
|
+
* <BaseUser user={user} fallback={<p>No user data</p>}>
|
|
54
|
+
* {(user) => (
|
|
55
|
+
* <div>
|
|
56
|
+
* <h1>Welcome, {user.displayName}!</h1>
|
|
57
|
+
* <p>Email: {user.email}</p>
|
|
58
|
+
* </div>
|
|
59
|
+
* )}
|
|
60
|
+
* </BaseUser>
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const BaseUser: FC<BaseUserProps>;
|
|
66
|
+
export default BaseUser;
|
|
@@ -15,18 +15,20 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { User as
|
|
18
|
+
import { User as IUser } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactNode } from 'react';
|
|
20
|
+
import { BaseUserProps } from './BaseUser';
|
|
20
21
|
/**
|
|
21
22
|
* Props for the User component.
|
|
23
|
+
* Extends BaseUserProps but makes the user prop optional since it will be obtained from useAsgardeo
|
|
22
24
|
*/
|
|
23
|
-
export interface UserProps {
|
|
25
|
+
export interface UserProps extends Omit<BaseUserProps, 'user'> {
|
|
24
26
|
/**
|
|
25
27
|
* Render prop that takes the user object and returns a ReactNode.
|
|
26
28
|
* @param user - The authenticated user object from Asgardeo.
|
|
27
29
|
* @returns A ReactNode to render.
|
|
28
30
|
*/
|
|
29
|
-
children: (user:
|
|
31
|
+
children: (user: IUser | null) => ReactNode;
|
|
30
32
|
/**
|
|
31
33
|
* Optional element to render when no user is signed in.
|
|
32
34
|
*/
|
|
@@ -34,10 +36,13 @@ export interface UserProps {
|
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* A component that uses render props to expose the authenticated user object.
|
|
39
|
+
* This component automatically retrieves the user from Asgardeo context.
|
|
40
|
+
*
|
|
41
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
37
42
|
*
|
|
38
43
|
* @example
|
|
39
44
|
* ```tsx
|
|
40
|
-
* import {
|
|
45
|
+
* import { IUser } from '@asgardeo/auth-react';
|
|
41
46
|
*
|
|
42
47
|
* const App = () => {
|
|
43
48
|
* return (
|
|
@@ -16,13 +16,34 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC, ReactElement } from 'react';
|
|
19
|
+
import { User } from '@asgardeo/browser';
|
|
20
|
+
interface ExtendedFlatSchema {
|
|
21
|
+
schemaId?: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
}
|
|
24
|
+
interface Schema extends ExtendedFlatSchema {
|
|
25
|
+
caseExact?: boolean;
|
|
26
|
+
description?: string;
|
|
27
|
+
displayName?: string;
|
|
28
|
+
displayOrder?: string;
|
|
29
|
+
multiValued?: boolean;
|
|
30
|
+
mutability?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
returned?: string;
|
|
34
|
+
type?: string;
|
|
35
|
+
uniqueness?: string;
|
|
36
|
+
value?: any;
|
|
37
|
+
subAttributes?: Schema[];
|
|
38
|
+
}
|
|
19
39
|
export interface BaseUserProfileProps {
|
|
20
40
|
fallback?: ReactElement;
|
|
21
41
|
className?: string;
|
|
22
42
|
cardLayout?: boolean;
|
|
23
|
-
|
|
43
|
+
profile?: User;
|
|
44
|
+
flattenedProfile?: User;
|
|
45
|
+
schemas?: Schema[];
|
|
24
46
|
mode?: 'inline' | 'popup';
|
|
25
|
-
portalId?: string;
|
|
26
47
|
title?: string;
|
|
27
48
|
attributeMapping?: {
|
|
28
49
|
picture?: string | string[];
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { HTMLAttributes, ReactNode, RefAttributes, ForwardRefExoticComponent } from 'react';
|
|
19
|
+
export type AlertVariant = 'success' | 'error' | 'warning' | 'info';
|
|
20
|
+
export interface AlertProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
/**
|
|
22
|
+
* The visual variant of the alert that determines color scheme and icon
|
|
23
|
+
*/
|
|
24
|
+
variant?: AlertVariant;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to show the default icon for the variant
|
|
27
|
+
*/
|
|
28
|
+
showIcon?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Alert content
|
|
31
|
+
*/
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export interface AlertTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
35
|
+
/**
|
|
36
|
+
* Title content
|
|
37
|
+
*/
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
export interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
41
|
+
/**
|
|
42
|
+
* Description content
|
|
43
|
+
*/
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Alert component that displays important information with different severity levels.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <Alert variant="success" showIcon>
|
|
52
|
+
* <Alert.Title>Success! Your changes have been saved</Alert.Title>
|
|
53
|
+
* <Alert.Description>
|
|
54
|
+
* This is an alert with icon, title and description.
|
|
55
|
+
* </Alert.Description>
|
|
56
|
+
* </Alert>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare const Alert: ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>>;
|
|
60
|
+
/**
|
|
61
|
+
* Alert title component.
|
|
62
|
+
*/
|
|
63
|
+
declare const AlertTitle: ForwardRefExoticComponent<AlertTitleProps & RefAttributes<HTMLHeadingElement>>;
|
|
64
|
+
/**
|
|
65
|
+
* Alert description component.
|
|
66
|
+
*/
|
|
67
|
+
declare const AlertDescription: ForwardRefExoticComponent<AlertDescriptionProps & RefAttributes<HTMLParagraphElement>>;
|
|
68
|
+
export interface AlertComponent extends ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> {
|
|
69
|
+
Title: typeof AlertTitle;
|
|
70
|
+
Description: typeof AlertDescription;
|
|
71
|
+
}
|
|
72
|
+
declare const _default: AlertComponent;
|
|
73
|
+
export default _default;
|
|
74
|
+
export { Alert, AlertTitle, AlertDescription };
|
|
@@ -0,0 +1,83 @@
|
|
|
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 { ButtonHTMLAttributes } from 'react';
|
|
19
|
+
export type ButtonColor = 'primary' | 'secondary' | 'tertiary' | string;
|
|
20
|
+
export type ButtonVariant = 'solid' | 'outline' | 'text';
|
|
21
|
+
export type ButtonSize = 'small' | 'medium' | 'large';
|
|
22
|
+
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {
|
|
23
|
+
/**
|
|
24
|
+
* The button color that determines the color scheme
|
|
25
|
+
*/
|
|
26
|
+
color?: ButtonColor;
|
|
27
|
+
/**
|
|
28
|
+
* The button variant that determines the visual style
|
|
29
|
+
*/
|
|
30
|
+
variant?: ButtonVariant;
|
|
31
|
+
/**
|
|
32
|
+
* The size of the button
|
|
33
|
+
*/
|
|
34
|
+
size?: ButtonSize;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the button should take the full width of its container
|
|
37
|
+
*/
|
|
38
|
+
fullWidth?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the button is in a loading state
|
|
41
|
+
*/
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Icon to display before the button text
|
|
45
|
+
*/
|
|
46
|
+
startIcon?: React.ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Icon to display after the button text
|
|
49
|
+
*/
|
|
50
|
+
endIcon?: React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Button component with multiple variants and types.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // Primary solid button
|
|
58
|
+
* <Button color="primary" variant="solid">
|
|
59
|
+
* Click me
|
|
60
|
+
* </Button>
|
|
61
|
+
*
|
|
62
|
+
* // Secondary outline button
|
|
63
|
+
* <Button color="secondary" variant="outline" size="large">
|
|
64
|
+
* Cancel
|
|
65
|
+
* </Button>
|
|
66
|
+
*
|
|
67
|
+
* // Text button with loading state
|
|
68
|
+
* <Button color="tertiary" variant="text" loading>
|
|
69
|
+
* Loading...
|
|
70
|
+
* </Button>
|
|
71
|
+
*
|
|
72
|
+
* // Button with icons
|
|
73
|
+
* <Button
|
|
74
|
+
* color="primary"
|
|
75
|
+
* startIcon={<Icon />}
|
|
76
|
+
* endIcon={<Arrow />}
|
|
77
|
+
* >
|
|
78
|
+
* Save and Continue
|
|
79
|
+
* </Button>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
83
|
+
export default Button;
|