@asgardeo/react 0.2.4 → 0.3.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 (91) hide show
  1. package/README.md +108 -6
  2. package/dist/AsgardeoReactClient.d.ts +37 -0
  3. package/dist/__temp__/api.d.ts +229 -0
  4. package/dist/__temp__/models.d.ts +105 -0
  5. package/dist/api/scim2/getMeProfile.d.ts +39 -0
  6. package/dist/api/scim2/getSchemas.d.ts +39 -0
  7. package/dist/api/scim2/updateMeProfile.d.ts +38 -0
  8. package/dist/cjs/index.js +1955 -0
  9. package/dist/cjs/index.js.map +7 -0
  10. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +65 -0
  11. package/dist/components/actions/SignInButton/SignInButton.d.ts +46 -0
  12. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +65 -0
  13. package/dist/components/actions/SignOutButton/SignOutButton.d.ts +44 -0
  14. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +65 -0
  15. package/dist/components/actions/SignUpButton/SignUpButton.d.ts +45 -0
  16. package/dist/components/control/SignedIn.d.ts +45 -0
  17. package/dist/components/control/SignedOut.d.ts +45 -0
  18. package/dist/components/presentation/User.d.ts +57 -0
  19. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +76 -0
  20. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +49 -0
  21. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +42 -0
  22. package/dist/components/presentation/UserProfile/UserProfile.d.ts +49 -0
  23. package/dist/{esm/types/components/SignIn/SignIn.d.ts → components/primitives/Avatar/Avatar.d.ts} +25 -14
  24. package/dist/{esm/types/oxygen-ui-react-auth-components/models/component.d.ts → components/primitives/Checkbox/Checkbox.d.ts} +22 -7
  25. package/dist/components/primitives/DatePicker/DatePicker.d.ts +50 -0
  26. package/dist/components/primitives/Popover/Popover.d.ts +59 -0
  27. package/dist/components/primitives/Select/Select.d.ts +60 -0
  28. package/dist/components/primitives/TextField/TextField.d.ts +46 -0
  29. package/dist/contexts/AsgardeoContext.d.ts +56 -0
  30. package/dist/{esm/types/contexts/i18n-context.d.ts → hooks/useAsgardeo.d.ts} +4 -5
  31. package/dist/hooks/useBrowserUrl.d.ts +47 -0
  32. package/dist/index.d.ts +36 -348
  33. package/dist/index.js +1935 -0
  34. package/dist/index.js.map +7 -0
  35. package/dist/{esm/types/oxygen-ui-react-auth-components/index.d.ts → models/config.d.ts} +3 -3
  36. package/dist/{esm/types/hooks/use-config.d.ts → providers/AsgardeoProvider.d.ts} +7 -5
  37. package/dist/{esm/types/models/asgardeo-provider-props.d.ts → theme/ThemeContext.d.ts} +8 -7
  38. package/dist/{esm/types/models/branding-preference-provider-props.d.ts → theme/ThemeProvider.d.ts} +7 -5
  39. package/dist/{esm/types/models/use-on.d.ts → theme/types.d.ts} +22 -12
  40. package/dist/{esm/types/models/public-models.d.ts → theme/useTheme.d.ts} +3 -3
  41. package/dist/{esm/types/models/signed-props.d.ts → utils/getMappedUserProfileValue.d.ts} +3 -6
  42. package/dist/utils/getUserProfile.d.ts +59 -0
  43. package/package.json +55 -60
  44. package/dist/esm/index.js +0 -45278
  45. package/dist/esm/index.js.map +0 -1
  46. package/dist/esm/types/components/SignIn/fragments/BasicAuth.d.ts +0 -35
  47. package/dist/esm/types/components/SignIn/fragments/EmailOtp.d.ts +0 -32
  48. package/dist/esm/types/components/SignIn/fragments/IdentifierFirst.d.ts +0 -35
  49. package/dist/esm/types/components/SignIn/fragments/LoginOptionsBox.d.ts +0 -30
  50. package/dist/esm/types/components/SignIn/fragments/SmsOtp.d.ts +0 -21
  51. package/dist/esm/types/components/SignIn/fragments/Totp.d.ts +0 -33
  52. package/dist/esm/types/components/SignInButton/SignInButton.d.ts +0 -29
  53. package/dist/esm/types/components/SignOutButton/SignOutButton.d.ts +0 -27
  54. package/dist/esm/types/components/SignedIn/SignedIn.d.ts +0 -29
  55. package/dist/esm/types/components/SignedOut/SignedOut.d.ts +0 -29
  56. package/dist/esm/types/components/public-components.d.ts +0 -22
  57. package/dist/esm/types/contexts/asgardeo-context.d.ts +0 -21
  58. package/dist/esm/types/contexts/branding-preference-context.d.ts +0 -21
  59. package/dist/esm/types/hooks/use-authentication.d.ts +0 -27
  60. package/dist/esm/types/hooks/use-on.d.ts +0 -20
  61. package/dist/esm/types/hooks/use-translations.d.ts +0 -33
  62. package/dist/esm/types/index.d.ts +0 -22
  63. package/dist/esm/types/models/auth-context.d.ts +0 -43
  64. package/dist/esm/types/models/basic-auth-props.d.ts +0 -29
  65. package/dist/esm/types/models/email-otp-props.d.ts +0 -26
  66. package/dist/esm/types/models/i18n.d.ts +0 -34
  67. package/dist/esm/types/models/jwt-verify-options.d.ts +0 -25
  68. package/dist/esm/types/models/login-options-box-props.d.ts +0 -24
  69. package/dist/esm/types/models/sign-in.d.ts +0 -49
  70. package/dist/esm/types/models/totp-props.d.ts +0 -26
  71. package/dist/esm/types/models/use-authentication.d.ts +0 -29
  72. package/dist/esm/types/models/use-config.d.ts +0 -22
  73. package/dist/esm/types/models/use-translations.d.ts +0 -22
  74. package/dist/esm/types/oxygen-ui-react-auth-components/SignIn/SignIn.d.ts +0 -79
  75. package/dist/esm/types/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.d.ts +0 -37
  76. package/dist/esm/types/oxygen-ui-react-auth-components/SignInButton/SignInButton.d.ts +0 -27
  77. package/dist/esm/types/oxygen-ui-react-auth-components/SignInDivider/SignInDivider.d.ts +0 -26
  78. package/dist/esm/types/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.d.ts +0 -29
  79. package/dist/esm/types/oxygen-ui-react-auth-components/SignInImage/SignInImage.d.ts +0 -23
  80. package/dist/esm/types/oxygen-ui-react-auth-components/SignInLink/SignInLink.d.ts +0 -25
  81. package/dist/esm/types/oxygen-ui-react-auth-components/SignInPaper/SignInPaper.d.ts +0 -26
  82. package/dist/esm/types/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.d.ts +0 -30
  83. package/dist/esm/types/oxygen-ui-react-auth-components/SignInTextField/SignInTextField.d.ts +0 -26
  84. package/dist/esm/types/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.d.ts +0 -32
  85. package/dist/esm/types/providers/AsgardeoProvider.d.ts +0 -34
  86. package/dist/esm/types/providers/BrandingPreferenceProvider.d.ts +0 -32
  87. package/dist/esm/types/providers/I18nProvider.d.ts +0 -33
  88. package/dist/esm/types/theme/generate-theme-sign-in.d.ts +0 -28
  89. package/dist/esm/types/theme/generate-theme.d.ts +0 -30
  90. package/dist/esm/types/utils/crypto-utils.d.ts +0 -52
  91. package/dist/esm/types/utils/session-store.d.ts +0 -25
@@ -0,0 +1,59 @@
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;
package/package.json CHANGED
@@ -1,80 +1,75 @@
1
1
  {
2
2
  "name": "@asgardeo/react",
3
- "version": "0.2.4",
4
- "description": "React Wrapper to build customizable login UIs for Asgardeo or Identity Server",
5
- "main": "dist/esm/index.js",
6
- "module": "dist/esm/index.js",
7
- "types": "dist/index.d.ts",
8
- "type": "module",
3
+ "version": "0.3.0",
4
+ "description": "React implementation of Asgardeo JavaScript SDK.",
5
+ "keywords": [
6
+ "asgardeo",
7
+ "react",
8
+ "spa"
9
+ ],
10
+ "homepage": "https://github.com/asgardeo/javascript/tree/main/packages/react#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/asgardeo/javascript/issues"
13
+ },
9
14
  "author": "WSO2",
10
15
  "license": "Apache-2.0",
16
+ "type": "module",
17
+ "main": "dist/cjs/index.js",
18
+ "module": "dist/index.js",
19
+ "exports": {
20
+ "import": "./dist/index.js",
21
+ "require": "./dist/cjs/index.js"
22
+ },
11
23
  "files": [
12
24
  "dist",
13
- "LICENSE",
14
- "README.md"
25
+ "README.md",
26
+ "LICENSE"
15
27
  ],
16
- "homepage": "https://github.com/asgardeo/web-ui-sdks/tree/main/packages/react#readme",
17
- "bugs": {
18
- "url": "https://github.com/asgardeo/web-ui-sdks/issues"
19
- },
28
+ "types": "dist/index.d.ts",
20
29
  "repository": {
21
30
  "type": "git",
22
- "url": "https://github.com/asgardeo/web-ui-sdks",
31
+ "url": "https://github.com/asgardeo/javascript",
23
32
  "directory": "packages/react"
24
33
  },
25
- "keywords": [
26
- "asgardeo",
27
- "identity",
28
- "ui",
29
- "react",
30
- "login",
31
- "customize"
32
- ],
33
- "publishConfig": {
34
- "access": "public"
35
- },
36
34
  "devDependencies": {
37
- "@rollup/plugin-commonjs": "^25.0.7",
38
- "@rollup/plugin-image": "^3.0.3",
39
- "@rollup/plugin-node-resolve": "^15.2.3",
40
- "@rollup/plugin-typescript": "^11.1.6",
41
- "@types/node": "^20.12.7",
42
- "@types/randombytes": "^2.0.3",
43
- "@types/react": "^18.2.79",
44
- "@types/react-dom": "^18.2.25",
45
- "@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?fa0b844715320a3953d6d055997c0770f8695082",
46
- "@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?fa0b844715320a3953d6d055997c0770f8695082",
47
- "@wso2/stylelint-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/stylelint-config?fa0b844715320a3953d6d055997c0770f8695082",
48
- "eslint": "~8.57.0",
49
- "prettier": "^3.2.5",
50
- "react": "^18.2.0",
51
- "react-dom": "^18.2.0",
52
- "rollup": "^4.17.2",
53
- "rollup-plugin-dts": "^6.1.0",
54
- "rollup-plugin-polyfill-node": "^0.13.0",
55
- "rollup-plugin-styles": "^4.0.0",
56
- "sass": "^1.75.0",
57
- "stylelint": "15.1.0",
58
- "tslib": "^2.6.2",
59
- "typescript": "5.1.6"
35
+ "@testing-library/dom": "^10.4.0",
36
+ "@types/node": "^22.15.3",
37
+ "@types/react": "^19.1.4",
38
+ "@vitest/browser": "^3.1.3",
39
+ "@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?a1fc6eb570653c999828aea9f5027cba06af4391",
40
+ "@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?a1fc6eb570653c999828aea9f5027cba06af4391",
41
+ "esbuild-plugin-preserve-directives": "^0.0.11",
42
+ "eslint": "8.57.0",
43
+ "playwright": "^1.52.0",
44
+ "prettier": "^2.6.2",
45
+ "react": "^19.1.0",
46
+ "rimraf": "^6.0.1",
47
+ "typescript": "~5.7.2",
48
+ "vitest": "^3.1.3",
49
+ "vitest-browser-react": "^0.1.1"
50
+ },
51
+ "peerDependencies": {
52
+ "@types/react": ">=16.8.0",
53
+ "react": ">=16.8.0"
60
54
  },
61
55
  "dependencies": {
62
- "@asgardeo/js": "*",
63
- "@oxygen-ui/react": "^1.11.0",
64
- "base64url": "^3.0.1",
65
- "buffer": "^6.0.3",
56
+ "@types/react-dom": "^19.1.5",
66
57
  "clsx": "^2.1.1",
67
- "fast-sha256": "^1.3.0",
68
- "jose": "^5.3.0",
69
- "randombytes": "^2.1.0"
58
+ "esbuild": "^0.25.4",
59
+ "react-dom": "^19.1.0",
60
+ "tslib": "^2.8.1",
61
+ "@asgardeo/browser": "^0.0.1"
70
62
  },
71
- "peerDependencies": {
72
- "react": ">=18.0.0",
73
- "react-dom": ">=18.0.0"
63
+ "publishConfig": {
64
+ "access": "public"
74
65
  },
75
66
  "scripts": {
76
- "build": "rollup -c",
77
- "lint": "eslint .",
78
- "lint:fix": "eslint . --fix"
67
+ "build": "pnpm clean && node esbuild.config.mjs && tsc -p tsconfig.lib.json --emitDeclarationOnly --outDir dist",
68
+ "clean": "rimraf dist",
69
+ "fix:lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
70
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
71
+ "test": "vitest",
72
+ "test:browser": "vitest --workspace=vitest.workspace.ts",
73
+ "typecheck": "tsc -p tsconfig.lib.json"
79
74
  }
80
75
  }