@asgardeo/react 0.2.4 → 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 +112 -6
- package/dist/AsgardeoReactClient.d.ts +38 -0
- package/dist/__temp__/api.d.ts +228 -0
- package/dist/__temp__/models.d.ts +97 -0
- package/dist/api/scim2/getMeProfile.d.ts +39 -0
- package/dist/api/scim2/getSchemas.d.ts +39 -0
- package/dist/api/scim2/updateMeProfile.d.ts +38 -0
- package/dist/cjs/index.js +17998 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +66 -0
- package/dist/components/actions/SignInButton/SignInButton.d.ts +65 -0
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +66 -0
- package/dist/components/actions/SignOutButton/SignOutButton.d.ts +65 -0
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +66 -0
- package/dist/components/actions/SignUpButton/SignUpButton.d.ts +66 -0
- package/dist/components/control/SignedIn.d.ts +45 -0
- package/dist/components/control/SignedOut.d.ts +45 -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/{esm/types/hooks/use-config.d.ts → components/presentation/SignIn/options/EmailOtp.d.ts} +7 -5
- 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/{esm/types/components/SignIn/fragments/SmsOtp.d.ts → components/presentation/SignIn/options/MicrosoftButton.d.ts} +9 -5
- package/dist/components/presentation/SignIn/options/MultiOptionButton.d.ts +26 -0
- package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +76 -0
- package/dist/{esm/types/components/SignOutButton/SignOutButton.d.ts → components/presentation/SignIn/options/SignInWithEthereumButton.d.ts} +7 -9
- package/dist/{esm/types/contexts/branding-preference-context.d.ts → components/presentation/SignIn/options/SmsOtp.d.ts} +9 -5
- package/dist/components/presentation/SignIn/options/SocialButton.d.ts +25 -0
- package/dist/{esm/types/contexts/asgardeo-context.d.ts → components/presentation/SignIn/options/Totp.d.ts} +9 -5
- 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/User.d.ts +62 -0
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +76 -0
- package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +49 -0
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +63 -0
- package/dist/components/presentation/UserProfile/UserProfile.d.ts +49 -0
- package/dist/components/primitives/Alert/Alert.d.ts +74 -0
- package/dist/{esm/types/components/SignIn/SignIn.d.ts → components/primitives/Avatar/Avatar.d.ts} +25 -14
- package/dist/components/primitives/Button/Button.d.ts +83 -0
- package/dist/components/primitives/Card/Card.d.ts +133 -0
- package/dist/{esm/types/oxygen-ui-react-auth-components/models/component.d.ts → components/primitives/Checkbox/Checkbox.d.ts} +22 -7
- package/dist/components/primitives/DatePicker/DatePicker.d.ts +50 -0
- 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/{esm/types/models/use-config.d.ts → components/primitives/Icons/Eye.d.ts} +7 -6
- package/dist/{esm/types/contexts/i18n-context.d.ts → components/primitives/Icons/EyeOff.d.ts} +7 -5
- package/dist/{esm/types/hooks/use-on.d.ts → components/primitives/Icons/Info.d.ts} +7 -4
- 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/{esm/types/components/SignInButton/SignInButton.d.ts → components/primitives/PasswordField/PasswordField.d.ts} +13 -11
- package/dist/components/primitives/Popover/Popover.d.ts +96 -0
- package/dist/components/primitives/Select/Select.d.ts +60 -0
- package/dist/components/primitives/Spinner/Spinner.d.ts +54 -0
- package/dist/components/primitives/TextField/TextField.d.ts +62 -0
- package/dist/components/primitives/Typography/Typography.d.ts +81 -0
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +57 -0
- package/dist/{esm/types/components/public-components.d.ts → contexts/Asgardeo/AsgardeoProvider.d.ts} +9 -6
- package/dist/contexts/Asgardeo/useAsgardeo.d.ts +20 -0
- 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/{esm/types/components/SignedIn/SignedIn.d.ts → contexts/I18n/I18nProvider.d.ts} +12 -10
- package/dist/contexts/I18n/useI18n.d.ts +27 -0
- package/dist/{esm/types/models/asgardeo-provider-props.d.ts → contexts/Theme/ThemeContext.d.ts} +8 -7
- package/dist/{esm/types/models/branding-preference-provider-props.d.ts → contexts/Theme/ThemeProvider.d.ts} +8 -5
- package/dist/{esm/types/models/use-on.d.ts → contexts/Theme/types.d.ts} +22 -12
- package/dist/{esm/types/models/signed-props.d.ts → contexts/Theme/useTheme.d.ts} +4 -6
- 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/useBrowserUrl.d.ts +47 -0
- package/dist/hooks/useForm.d.ts +192 -0
- package/dist/hooks/useTranslation.d.ts +52 -0
- package/dist/index.d.ts +121 -348
- package/dist/index.js +18064 -0
- package/dist/index.js.map +7 -0
- package/dist/{esm/types/models/public-models.d.ts → models/config.d.ts} +3 -3
- package/dist/utils/getMappedUserProfileValue.d.ts +51 -0
- package/package.json +55 -59
- package/dist/esm/index.js +0 -45278
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types/components/SignIn/fragments/BasicAuth.d.ts +0 -35
- package/dist/esm/types/components/SignIn/fragments/EmailOtp.d.ts +0 -32
- package/dist/esm/types/components/SignIn/fragments/IdentifierFirst.d.ts +0 -35
- package/dist/esm/types/components/SignIn/fragments/LoginOptionsBox.d.ts +0 -30
- package/dist/esm/types/components/SignIn/fragments/Totp.d.ts +0 -33
- package/dist/esm/types/components/SignedOut/SignedOut.d.ts +0 -29
- package/dist/esm/types/hooks/use-authentication.d.ts +0 -27
- package/dist/esm/types/hooks/use-translations.d.ts +0 -33
- package/dist/esm/types/index.d.ts +0 -22
- package/dist/esm/types/models/auth-context.d.ts +0 -43
- package/dist/esm/types/models/basic-auth-props.d.ts +0 -29
- package/dist/esm/types/models/email-otp-props.d.ts +0 -26
- package/dist/esm/types/models/i18n.d.ts +0 -34
- package/dist/esm/types/models/jwt-verify-options.d.ts +0 -25
- package/dist/esm/types/models/login-options-box-props.d.ts +0 -24
- package/dist/esm/types/models/sign-in.d.ts +0 -49
- package/dist/esm/types/models/totp-props.d.ts +0 -26
- package/dist/esm/types/models/use-authentication.d.ts +0 -29
- package/dist/esm/types/models/use-translations.d.ts +0 -22
- package/dist/esm/types/oxygen-ui-react-auth-components/SignIn/SignIn.d.ts +0 -79
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.d.ts +0 -37
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInButton/SignInButton.d.ts +0 -27
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInDivider/SignInDivider.d.ts +0 -26
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.d.ts +0 -29
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInImage/SignInImage.d.ts +0 -23
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInLink/SignInLink.d.ts +0 -25
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInPaper/SignInPaper.d.ts +0 -26
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.d.ts +0 -30
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInTextField/SignInTextField.d.ts +0 -26
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.d.ts +0 -32
- package/dist/esm/types/oxygen-ui-react-auth-components/index.d.ts +0 -19
- package/dist/esm/types/providers/AsgardeoProvider.d.ts +0 -34
- package/dist/esm/types/providers/BrandingPreferenceProvider.d.ts +0 -32
- package/dist/esm/types/providers/I18nProvider.d.ts +0 -33
- package/dist/esm/types/theme/generate-theme-sign-in.d.ts +0 -28
- package/dist/esm/types/theme/generate-theme.d.ts +0 -30
- package/dist/esm/types/utils/crypto-utils.d.ts +0 -52
- package/dist/esm/types/utils/session-store.d.ts +0 -25
|
@@ -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;
|
|
@@ -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 { User as IUser } from '@asgardeo/browser';
|
|
19
|
+
import { FC, ReactNode } from 'react';
|
|
20
|
+
import { BaseUserProps } from './BaseUser';
|
|
21
|
+
/**
|
|
22
|
+
* Props for the User component.
|
|
23
|
+
* Extends BaseUserProps but makes the user prop optional since it will be obtained from useAsgardeo
|
|
24
|
+
*/
|
|
25
|
+
export interface UserProps extends Omit<BaseUserProps, 'user'> {
|
|
26
|
+
/**
|
|
27
|
+
* Render prop that takes the user object and returns a ReactNode.
|
|
28
|
+
* @param user - The authenticated user object from Asgardeo.
|
|
29
|
+
* @returns A ReactNode to render.
|
|
30
|
+
*/
|
|
31
|
+
children: (user: IUser | null) => ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Optional element to render when no user is signed in.
|
|
34
|
+
*/
|
|
35
|
+
fallback?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
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).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* import { IUser } from '@asgardeo/auth-react';
|
|
46
|
+
*
|
|
47
|
+
* const App = () => {
|
|
48
|
+
* return (
|
|
49
|
+
* <User fallback={<p>Please sign in</p>}>
|
|
50
|
+
* {(user) => (
|
|
51
|
+
* <div>
|
|
52
|
+
* <h1>Welcome, {user.displayName}!</h1>
|
|
53
|
+
* <p>Email: {user.email}</p>
|
|
54
|
+
* </div>
|
|
55
|
+
* )}
|
|
56
|
+
* </User>
|
|
57
|
+
* );
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare const User: FC<UserProps>;
|
|
62
|
+
export default User;
|
|
@@ -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 { FC, ReactElement, ReactNode } from 'react';
|
|
19
|
+
export interface MenuItem {
|
|
20
|
+
label: string;
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
href?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface BaseUserDropdownProps {
|
|
26
|
+
/**
|
|
27
|
+
* Optional element to render when no user is signed in.
|
|
28
|
+
*/
|
|
29
|
+
fallback?: ReactElement;
|
|
30
|
+
/**
|
|
31
|
+
* Optional className for the dropdown container.
|
|
32
|
+
*/
|
|
33
|
+
className?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The user object containing profile information
|
|
36
|
+
*/
|
|
37
|
+
user: any;
|
|
38
|
+
/**
|
|
39
|
+
* The HTML element ID where the portal should be mounted
|
|
40
|
+
*/
|
|
41
|
+
portalId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Menu items to display in the dropdown
|
|
44
|
+
*/
|
|
45
|
+
menuItems?: MenuItem[];
|
|
46
|
+
/**
|
|
47
|
+
* Show user's display name next to avatar in the trigger button
|
|
48
|
+
*/
|
|
49
|
+
showTriggerLabel?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Show dropdown header with user information
|
|
52
|
+
*/
|
|
53
|
+
showDropdownHeader?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Optional size for the avatar
|
|
56
|
+
*/
|
|
57
|
+
avatarSize?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Mapping of component attribute names to identity provider field names.
|
|
60
|
+
* Allows customizing which user profile fields should be used for each attribute.
|
|
61
|
+
*/
|
|
62
|
+
attributeMapping?: {
|
|
63
|
+
picture?: string | string[];
|
|
64
|
+
firstName?: string | string[];
|
|
65
|
+
lastName?: string | string[];
|
|
66
|
+
username?: string | string[];
|
|
67
|
+
[key: string]: string | string[] | undefined;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* BaseUserDropdown component displays a user avatar with a dropdown menu.
|
|
72
|
+
* When clicked, it shows a popover with customizable menu items.
|
|
73
|
+
* This component serves as the base for framework-specific implementations.
|
|
74
|
+
*/
|
|
75
|
+
export declare const BaseUserDropdown: FC<BaseUserDropdownProps>;
|
|
76
|
+
export default BaseUserDropdown;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { BaseUserDropdownProps } from './BaseUserDropdown';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the UserDropdown component.
|
|
22
|
+
* Extends BaseUserDropdownProps but makes the user prop optional since it will be obtained from useAsgardeo
|
|
23
|
+
*/
|
|
24
|
+
export type UserDropdownProps = Omit<BaseUserDropdownProps, 'user'>;
|
|
25
|
+
/**
|
|
26
|
+
* UserDropdown component displays a user avatar with a dropdown menu.
|
|
27
|
+
* When clicked, it shows a popover with customizable menu items.
|
|
28
|
+
* This component is the React-specific implementation that uses the BaseUserDropdown
|
|
29
|
+
* and automatically retrieves the user data from Asgardeo context.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Basic usage - will use user from Asgardeo context
|
|
34
|
+
* <UserDropdown menuItems={[
|
|
35
|
+
* { label: 'Profile', onClick: () => {} },
|
|
36
|
+
* { label: 'Settings', href: '/settings' },
|
|
37
|
+
* { label: 'Sign Out', onClick: () => {} }
|
|
38
|
+
* ]} />
|
|
39
|
+
*
|
|
40
|
+
* // With custom configuration
|
|
41
|
+
* <UserDropdown
|
|
42
|
+
* showUsername={false}
|
|
43
|
+
* avatarSize={40}
|
|
44
|
+
* fallback={<div>Please sign in</div>}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare const UserDropdown: FC<UserDropdownProps>;
|
|
49
|
+
export default UserDropdown;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { 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
|
+
}
|
|
39
|
+
export interface BaseUserProfileProps {
|
|
40
|
+
fallback?: ReactElement;
|
|
41
|
+
className?: string;
|
|
42
|
+
cardLayout?: boolean;
|
|
43
|
+
profile?: User;
|
|
44
|
+
flattenedProfile?: User;
|
|
45
|
+
schemas?: Schema[];
|
|
46
|
+
mode?: 'inline' | 'popup';
|
|
47
|
+
title?: string;
|
|
48
|
+
attributeMapping?: {
|
|
49
|
+
picture?: string | string[];
|
|
50
|
+
firstName?: string | string[];
|
|
51
|
+
lastName?: string | string[];
|
|
52
|
+
username?: string | string[];
|
|
53
|
+
[key: string]: string | string[] | undefined;
|
|
54
|
+
};
|
|
55
|
+
editable?: boolean;
|
|
56
|
+
onChange?: (field: string, value: any) => void;
|
|
57
|
+
onSubmit?: (data: any) => void;
|
|
58
|
+
saveButtonText?: string;
|
|
59
|
+
cancelButtonText?: string;
|
|
60
|
+
onUpdate?: (payload: any) => Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
declare const BaseUserProfile: FC<BaseUserProfileProps>;
|
|
63
|
+
export default BaseUserProfile;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { BaseUserProfileProps } from './BaseUserProfile';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the UserProfile component.
|
|
22
|
+
* Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useAsgardeo
|
|
23
|
+
*/
|
|
24
|
+
export type UserProfileProps = Omit<BaseUserProfileProps, 'user'>;
|
|
25
|
+
/**
|
|
26
|
+
* UserProfile component displays the authenticated user's profile information in a
|
|
27
|
+
* structured and styled format. It shows user details such as display name, email,
|
|
28
|
+
* username, and other available profile information from Asgardeo.
|
|
29
|
+
*
|
|
30
|
+
* This component is the React-specific implementation that uses the BaseUserProfile
|
|
31
|
+
* and automatically retrieves the user data from Asgardeo context if not provided.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Basic usage - will use user from Asgardeo context
|
|
36
|
+
* <UserProfile />
|
|
37
|
+
*
|
|
38
|
+
* // With explicit user data
|
|
39
|
+
* <UserProfile user={specificUser} />
|
|
40
|
+
*
|
|
41
|
+
* // With card layout and custom fallback
|
|
42
|
+
* <UserProfile
|
|
43
|
+
* cardLayout={true}
|
|
44
|
+
* fallback={<div>Please sign in to view your profile</div>}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare const UserProfile: FC<UserProfileProps>;
|
|
49
|
+
export default UserProfile;
|
|
@@ -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 };
|
package/dist/{esm/types/components/SignIn/SignIn.d.ts → components/primitives/Avatar/Avatar.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
3
|
*
|
|
4
4
|
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -16,16 +16,27 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
export interface AvatarProps {
|
|
20
|
+
/**
|
|
21
|
+
* The URL of the avatar image
|
|
22
|
+
*/
|
|
23
|
+
imageUrl?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Alternative text for the avatar image
|
|
26
|
+
*/
|
|
27
|
+
alt?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The size of the avatar in pixels
|
|
30
|
+
*/
|
|
31
|
+
size?: number;
|
|
32
|
+
/**
|
|
33
|
+
* The name to use for generating initials when no image is provided
|
|
34
|
+
*/
|
|
35
|
+
name?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Optional className for the avatar
|
|
38
|
+
*/
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare const Avatar: FC<AvatarProps>;
|
|
42
|
+
export default Avatar;
|