@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.
Files changed (79) hide show
  1. package/README.md +5 -1
  2. package/dist/AsgardeoReactClient.d.ts +3 -2
  3. package/dist/__temp__/api.d.ts +17 -18
  4. package/dist/__temp__/models.d.ts +13 -21
  5. package/dist/cjs/index.js +17252 -1209
  6. package/dist/cjs/index.js.map +4 -4
  7. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +4 -3
  8. package/dist/components/actions/SignInButton/SignInButton.d.ts +21 -2
  9. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +4 -3
  10. package/dist/components/actions/SignOutButton/SignOutButton.d.ts +22 -1
  11. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +2 -1
  12. package/dist/components/actions/SignUpButton/SignUpButton.d.ts +21 -0
  13. package/dist/components/factories/FieldFactory.d.ts +107 -0
  14. package/dist/components/presentation/SignIn/BaseSignIn.d.ts +125 -0
  15. package/dist/components/presentation/SignIn/SignIn.d.ts +62 -0
  16. package/dist/components/presentation/SignIn/options/EmailOtp.d.ts +25 -0
  17. package/dist/components/presentation/SignIn/options/FacebookButton.d.ts +25 -0
  18. package/dist/components/presentation/SignIn/options/GitHubButton.d.ts +25 -0
  19. package/dist/components/presentation/SignIn/options/GoogleButton.d.ts +25 -0
  20. package/dist/components/presentation/SignIn/options/IdentifierFirst.d.ts +25 -0
  21. package/dist/components/presentation/SignIn/options/LinkedInButton.d.ts +25 -0
  22. package/dist/components/presentation/SignIn/options/MicrosoftButton.d.ts +25 -0
  23. package/dist/components/presentation/SignIn/options/MultiOptionButton.d.ts +26 -0
  24. package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +76 -0
  25. package/dist/components/presentation/SignIn/options/SignInWithEthereumButton.d.ts +25 -0
  26. package/dist/components/presentation/SignIn/options/SmsOtp.d.ts +25 -0
  27. package/dist/components/presentation/SignIn/options/SocialButton.d.ts +25 -0
  28. package/dist/components/presentation/SignIn/options/Totp.d.ts +25 -0
  29. package/dist/components/presentation/SignIn/options/UsernamePassword.d.ts +25 -0
  30. package/dist/components/presentation/SignIn/types.d.ts +124 -0
  31. package/dist/components/presentation/User/BaseUser.d.ts +66 -0
  32. package/dist/components/presentation/{User.d.ts → User/User.d.ts} +9 -4
  33. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +1 -1
  34. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +23 -2
  35. package/dist/components/primitives/Alert/Alert.d.ts +74 -0
  36. package/dist/components/primitives/Button/Button.d.ts +83 -0
  37. package/dist/components/primitives/Card/Card.d.ts +133 -0
  38. package/dist/components/primitives/Checkbox/Checkbox.d.ts +1 -1
  39. package/dist/components/primitives/DatePicker/DatePicker.d.ts +1 -1
  40. package/dist/components/primitives/Divider/Divider.d.ts +58 -0
  41. package/dist/components/primitives/FormControl/FormControl.d.ts +50 -0
  42. package/dist/components/primitives/Icons/CircleAlert.d.ts +23 -0
  43. package/dist/components/primitives/Icons/CircleCheck.d.ts +23 -0
  44. package/dist/components/primitives/Icons/Eye.d.ts +23 -0
  45. package/dist/components/primitives/Icons/EyeOff.d.ts +23 -0
  46. package/dist/components/primitives/Icons/Info.d.ts +23 -0
  47. package/dist/components/primitives/Icons/TriangleAlert.d.ts +23 -0
  48. package/dist/components/primitives/InputLabel/InputLabel.d.ts +46 -0
  49. package/dist/components/primitives/OtpField/OtpField.d.ts +86 -0
  50. package/dist/components/primitives/PasswordField/PasswordField.d.ts +31 -0
  51. package/dist/components/primitives/Popover/Popover.d.ts +71 -34
  52. package/dist/components/primitives/Select/Select.d.ts +1 -1
  53. package/dist/components/primitives/Spinner/Spinner.d.ts +54 -0
  54. package/dist/components/primitives/TextField/TextField.d.ts +18 -2
  55. package/dist/components/primitives/Typography/Typography.d.ts +81 -0
  56. package/dist/contexts/{AsgardeoContext.d.ts → Asgardeo/AsgardeoContext.d.ts} +1 -0
  57. package/dist/{providers → contexts/Asgardeo}/AsgardeoProvider.d.ts +1 -1
  58. package/dist/{hooks → contexts/Asgardeo}/useAsgardeo.d.ts +1 -1
  59. package/dist/contexts/Flow/FlowContext.d.ts +73 -0
  60. package/dist/contexts/Flow/FlowProvider.d.ts +46 -0
  61. package/dist/contexts/Flow/useFlow.d.ts +48 -0
  62. package/dist/contexts/I18n/I18nContext.d.ts +42 -0
  63. package/dist/contexts/I18n/I18nProvider.d.ts +31 -0
  64. package/dist/contexts/I18n/useI18n.d.ts +27 -0
  65. package/dist/{theme → contexts/Theme}/ThemeProvider.d.ts +2 -1
  66. package/dist/{theme → contexts/Theme}/useTheme.d.ts +2 -1
  67. package/dist/contexts/User/UserContext.d.ts +32 -0
  68. package/dist/contexts/User/UserProvider.d.ts +55 -0
  69. package/dist/contexts/User/useUser.d.ts +94 -0
  70. package/dist/hooks/useForm.d.ts +192 -0
  71. package/dist/hooks/useTranslation.d.ts +52 -0
  72. package/dist/index.d.ts +94 -9
  73. package/dist/index.js +17242 -1113
  74. package/dist/index.js.map +4 -4
  75. package/dist/utils/getMappedUserProfileValue.d.ts +33 -1
  76. package/package.json +6 -5
  77. package/dist/utils/getUserProfile.d.ts +0 -59
  78. /package/dist/{theme → contexts/Theme}/ThemeContext.d.ts +0 -0
  79. /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
- declare const getMappedUserProfileValue: (key: string, mappings: any, user: any) => any;
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.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/javascript/tree/main/packages/react#readme",
10
+ "homepage": "https://github.com/asgardeo/web-ui-sdks/tree/main/packages/react#readme",
11
11
  "bugs": {
12
- "url": "https://github.com/asgardeo/javascript/issues"
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/javascript",
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.1"
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