@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
|
@@ -15,5 +15,37 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
import { User } from '@asgardeo/browser';
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves a user profile value based on attribute mapping configuration.
|
|
21
|
+
*
|
|
22
|
+
* This function allows flexible mapping of component attribute names to actual
|
|
23
|
+
* user profile field paths. It supports both simple string mappings and arrays
|
|
24
|
+
* of potential field paths for fallback scenarios.
|
|
25
|
+
*
|
|
26
|
+
* @param key - The logical attribute name to retrieve (e.g., 'firstName', 'email')
|
|
27
|
+
* @param mappings - Object mapping logical names to user profile field paths
|
|
28
|
+
* @param user - The user object to extract values from
|
|
29
|
+
* @returns The mapped value from the user profile, or undefined if not found
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const mappings = {
|
|
34
|
+
* firstName: 'name.givenName',
|
|
35
|
+
* email: 'emails[0]',
|
|
36
|
+
* picture: ['profileUrl', 'profile', 'avatar'] // fallback options
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* const user = {
|
|
40
|
+
* name: { givenName: 'John' },
|
|
41
|
+
* emails: ['john@example.com'],
|
|
42
|
+
* profileUrl: 'https://example.com/avatar.jpg'
|
|
43
|
+
* };
|
|
44
|
+
*
|
|
45
|
+
* getMappedUserProfileValue('firstName', mappings, user); // 'John'
|
|
46
|
+
* getMappedUserProfileValue('email', mappings, user); // 'john@example.com'
|
|
47
|
+
* getMappedUserProfileValue('picture', mappings, user); // 'https://example.com/avatar.jpg'
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare const getMappedUserProfileValue: (key: string, mappings: Record<string, string | string[]>, user: User) => any;
|
|
19
51
|
export default getMappedUserProfileValue;
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React implementation of Asgardeo JavaScript SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"asgardeo",
|
|
7
7
|
"react",
|
|
8
8
|
"spa"
|
|
9
9
|
],
|
|
10
|
-
"homepage": "https://github.com/asgardeo/
|
|
10
|
+
"homepage": "https://github.com/asgardeo/web-ui-sdks/tree/main/packages/react#readme",
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/asgardeo/
|
|
12
|
+
"url": "https://github.com/asgardeo/web-ui-sdks/issues"
|
|
13
13
|
},
|
|
14
14
|
"author": "WSO2",
|
|
15
15
|
"license": "Apache-2.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"types": "dist/index.d.ts",
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "https://github.com/asgardeo/
|
|
31
|
+
"url": "https://github.com/asgardeo/web-ui-sdks",
|
|
32
32
|
"directory": "packages/react"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -53,12 +53,13 @@
|
|
|
53
53
|
"react": ">=16.8.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
+
"@floating-ui/react": "^0.27.12",
|
|
56
57
|
"@types/react-dom": "^19.1.5",
|
|
57
58
|
"clsx": "^2.1.1",
|
|
58
59
|
"esbuild": "^0.25.4",
|
|
59
60
|
"react-dom": "^19.1.0",
|
|
60
61
|
"tslib": "^2.8.1",
|
|
61
|
-
"@asgardeo/browser": "^0.0
|
|
62
|
+
"@asgardeo/browser": "^0.1.0"
|
|
62
63
|
},
|
|
63
64
|
"publishConfig": {
|
|
64
65
|
"access": "public"
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
/**
|
|
19
|
-
* Retrieves the authenticated user's profile information with all SCIM2 schema properties
|
|
20
|
-
* flattened to the root level for easier access.
|
|
21
|
-
*
|
|
22
|
-
* The function flattens properties from all schemas defined in WellKnownSchemaIds:
|
|
23
|
-
* - Core User properties (urn:ietf:params:scim:schemas:core:2.0:User)
|
|
24
|
-
* - Enterprise User properties (urn:ietf:params:scim:schemas:extension:enterprise:2.0:User)
|
|
25
|
-
* - System User properties (urn:scim:wso2:schema)
|
|
26
|
-
* - Custom User properties (urn:scim:schemas:extension:custom:User)
|
|
27
|
-
*
|
|
28
|
-
* @param requestConfig - Request configuration object.
|
|
29
|
-
* @returns A promise that resolves with the flattened user profile information.
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* try {
|
|
33
|
-
* const userProfile = await getUserProfile({
|
|
34
|
-
* url: "https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me",
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* // Access flattened properties directly:
|
|
38
|
-
* console.log("Email:", userProfile.emails[0]);
|
|
39
|
-
* console.log("Name:", userProfile.name.formatted);
|
|
40
|
-
* console.log("Username:", userProfile.userName);
|
|
41
|
-
*
|
|
42
|
-
* // WSO2 specific properties:
|
|
43
|
-
* console.log("Account State:", userProfile.accountState);
|
|
44
|
-
* console.log("Email Verified:", userProfile.emailVerified);
|
|
45
|
-
*
|
|
46
|
-
* // Enterprise properties (if available):
|
|
47
|
-
* console.log("Employee Number:", userProfile.employeeNumber);
|
|
48
|
-
* console.log("Cost Center:", userProfile.costCenter);
|
|
49
|
-
* } catch (error) {
|
|
50
|
-
* if (error instanceof AsgardeoAPIError) {
|
|
51
|
-
* console.error('Failed to get user profile:', error.message);
|
|
52
|
-
* }
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
declare const getUserProfile: ({ baseUrl }: {
|
|
57
|
-
baseUrl: any;
|
|
58
|
-
}) => Promise<any>;
|
|
59
|
-
export default getUserProfile;
|
|
File without changes
|
|
File without changes
|