@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.
Files changed (128) hide show
  1. package/README.md +112 -6
  2. package/dist/AsgardeoReactClient.d.ts +38 -0
  3. package/dist/__temp__/api.d.ts +228 -0
  4. package/dist/__temp__/models.d.ts +97 -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 +17998 -0
  9. package/dist/cjs/index.js.map +7 -0
  10. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +66 -0
  11. package/dist/components/actions/SignInButton/SignInButton.d.ts +65 -0
  12. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +66 -0
  13. package/dist/components/actions/SignOutButton/SignOutButton.d.ts +65 -0
  14. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +66 -0
  15. package/dist/components/actions/SignUpButton/SignUpButton.d.ts +66 -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/factories/FieldFactory.d.ts +107 -0
  19. package/dist/components/presentation/SignIn/BaseSignIn.d.ts +125 -0
  20. package/dist/components/presentation/SignIn/SignIn.d.ts +62 -0
  21. package/dist/{esm/types/hooks/use-config.d.ts → components/presentation/SignIn/options/EmailOtp.d.ts} +7 -5
  22. package/dist/components/presentation/SignIn/options/FacebookButton.d.ts +25 -0
  23. package/dist/components/presentation/SignIn/options/GitHubButton.d.ts +25 -0
  24. package/dist/components/presentation/SignIn/options/GoogleButton.d.ts +25 -0
  25. package/dist/components/presentation/SignIn/options/IdentifierFirst.d.ts +25 -0
  26. package/dist/components/presentation/SignIn/options/LinkedInButton.d.ts +25 -0
  27. package/dist/{esm/types/components/SignIn/fragments/SmsOtp.d.ts → components/presentation/SignIn/options/MicrosoftButton.d.ts} +9 -5
  28. package/dist/components/presentation/SignIn/options/MultiOptionButton.d.ts +26 -0
  29. package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +76 -0
  30. package/dist/{esm/types/components/SignOutButton/SignOutButton.d.ts → components/presentation/SignIn/options/SignInWithEthereumButton.d.ts} +7 -9
  31. package/dist/{esm/types/contexts/branding-preference-context.d.ts → components/presentation/SignIn/options/SmsOtp.d.ts} +9 -5
  32. package/dist/components/presentation/SignIn/options/SocialButton.d.ts +25 -0
  33. package/dist/{esm/types/contexts/asgardeo-context.d.ts → components/presentation/SignIn/options/Totp.d.ts} +9 -5
  34. package/dist/components/presentation/SignIn/options/UsernamePassword.d.ts +25 -0
  35. package/dist/components/presentation/SignIn/types.d.ts +124 -0
  36. package/dist/components/presentation/User/BaseUser.d.ts +66 -0
  37. package/dist/components/presentation/User/User.d.ts +62 -0
  38. package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +76 -0
  39. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +49 -0
  40. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +63 -0
  41. package/dist/components/presentation/UserProfile/UserProfile.d.ts +49 -0
  42. package/dist/components/primitives/Alert/Alert.d.ts +74 -0
  43. package/dist/{esm/types/components/SignIn/SignIn.d.ts → components/primitives/Avatar/Avatar.d.ts} +25 -14
  44. package/dist/components/primitives/Button/Button.d.ts +83 -0
  45. package/dist/components/primitives/Card/Card.d.ts +133 -0
  46. package/dist/{esm/types/oxygen-ui-react-auth-components/models/component.d.ts → components/primitives/Checkbox/Checkbox.d.ts} +22 -7
  47. package/dist/components/primitives/DatePicker/DatePicker.d.ts +50 -0
  48. package/dist/components/primitives/Divider/Divider.d.ts +58 -0
  49. package/dist/components/primitives/FormControl/FormControl.d.ts +50 -0
  50. package/dist/components/primitives/Icons/CircleAlert.d.ts +23 -0
  51. package/dist/components/primitives/Icons/CircleCheck.d.ts +23 -0
  52. package/dist/{esm/types/models/use-config.d.ts → components/primitives/Icons/Eye.d.ts} +7 -6
  53. package/dist/{esm/types/contexts/i18n-context.d.ts → components/primitives/Icons/EyeOff.d.ts} +7 -5
  54. package/dist/{esm/types/hooks/use-on.d.ts → components/primitives/Icons/Info.d.ts} +7 -4
  55. package/dist/components/primitives/Icons/TriangleAlert.d.ts +23 -0
  56. package/dist/components/primitives/InputLabel/InputLabel.d.ts +46 -0
  57. package/dist/components/primitives/OtpField/OtpField.d.ts +86 -0
  58. package/dist/{esm/types/components/SignInButton/SignInButton.d.ts → components/primitives/PasswordField/PasswordField.d.ts} +13 -11
  59. package/dist/components/primitives/Popover/Popover.d.ts +96 -0
  60. package/dist/components/primitives/Select/Select.d.ts +60 -0
  61. package/dist/components/primitives/Spinner/Spinner.d.ts +54 -0
  62. package/dist/components/primitives/TextField/TextField.d.ts +62 -0
  63. package/dist/components/primitives/Typography/Typography.d.ts +81 -0
  64. package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +57 -0
  65. package/dist/{esm/types/components/public-components.d.ts → contexts/Asgardeo/AsgardeoProvider.d.ts} +9 -6
  66. package/dist/contexts/Asgardeo/useAsgardeo.d.ts +20 -0
  67. package/dist/contexts/Flow/FlowContext.d.ts +73 -0
  68. package/dist/contexts/Flow/FlowProvider.d.ts +46 -0
  69. package/dist/contexts/Flow/useFlow.d.ts +48 -0
  70. package/dist/contexts/I18n/I18nContext.d.ts +42 -0
  71. package/dist/{esm/types/components/SignedIn/SignedIn.d.ts → contexts/I18n/I18nProvider.d.ts} +12 -10
  72. package/dist/contexts/I18n/useI18n.d.ts +27 -0
  73. package/dist/{esm/types/models/asgardeo-provider-props.d.ts → contexts/Theme/ThemeContext.d.ts} +8 -7
  74. package/dist/{esm/types/models/branding-preference-provider-props.d.ts → contexts/Theme/ThemeProvider.d.ts} +8 -5
  75. package/dist/{esm/types/models/use-on.d.ts → contexts/Theme/types.d.ts} +22 -12
  76. package/dist/{esm/types/models/signed-props.d.ts → contexts/Theme/useTheme.d.ts} +4 -6
  77. package/dist/contexts/User/UserContext.d.ts +32 -0
  78. package/dist/contexts/User/UserProvider.d.ts +55 -0
  79. package/dist/contexts/User/useUser.d.ts +94 -0
  80. package/dist/hooks/useBrowserUrl.d.ts +47 -0
  81. package/dist/hooks/useForm.d.ts +192 -0
  82. package/dist/hooks/useTranslation.d.ts +52 -0
  83. package/dist/index.d.ts +121 -348
  84. package/dist/index.js +18064 -0
  85. package/dist/index.js.map +7 -0
  86. package/dist/{esm/types/models/public-models.d.ts → models/config.d.ts} +3 -3
  87. package/dist/utils/getMappedUserProfileValue.d.ts +51 -0
  88. package/package.json +55 -59
  89. package/dist/esm/index.js +0 -45278
  90. package/dist/esm/index.js.map +0 -1
  91. package/dist/esm/types/components/SignIn/fragments/BasicAuth.d.ts +0 -35
  92. package/dist/esm/types/components/SignIn/fragments/EmailOtp.d.ts +0 -32
  93. package/dist/esm/types/components/SignIn/fragments/IdentifierFirst.d.ts +0 -35
  94. package/dist/esm/types/components/SignIn/fragments/LoginOptionsBox.d.ts +0 -30
  95. package/dist/esm/types/components/SignIn/fragments/Totp.d.ts +0 -33
  96. package/dist/esm/types/components/SignedOut/SignedOut.d.ts +0 -29
  97. package/dist/esm/types/hooks/use-authentication.d.ts +0 -27
  98. package/dist/esm/types/hooks/use-translations.d.ts +0 -33
  99. package/dist/esm/types/index.d.ts +0 -22
  100. package/dist/esm/types/models/auth-context.d.ts +0 -43
  101. package/dist/esm/types/models/basic-auth-props.d.ts +0 -29
  102. package/dist/esm/types/models/email-otp-props.d.ts +0 -26
  103. package/dist/esm/types/models/i18n.d.ts +0 -34
  104. package/dist/esm/types/models/jwt-verify-options.d.ts +0 -25
  105. package/dist/esm/types/models/login-options-box-props.d.ts +0 -24
  106. package/dist/esm/types/models/sign-in.d.ts +0 -49
  107. package/dist/esm/types/models/totp-props.d.ts +0 -26
  108. package/dist/esm/types/models/use-authentication.d.ts +0 -29
  109. package/dist/esm/types/models/use-translations.d.ts +0 -22
  110. package/dist/esm/types/oxygen-ui-react-auth-components/SignIn/SignIn.d.ts +0 -79
  111. package/dist/esm/types/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.d.ts +0 -37
  112. package/dist/esm/types/oxygen-ui-react-auth-components/SignInButton/SignInButton.d.ts +0 -27
  113. package/dist/esm/types/oxygen-ui-react-auth-components/SignInDivider/SignInDivider.d.ts +0 -26
  114. package/dist/esm/types/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.d.ts +0 -29
  115. package/dist/esm/types/oxygen-ui-react-auth-components/SignInImage/SignInImage.d.ts +0 -23
  116. package/dist/esm/types/oxygen-ui-react-auth-components/SignInLink/SignInLink.d.ts +0 -25
  117. package/dist/esm/types/oxygen-ui-react-auth-components/SignInPaper/SignInPaper.d.ts +0 -26
  118. package/dist/esm/types/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.d.ts +0 -30
  119. package/dist/esm/types/oxygen-ui-react-auth-components/SignInTextField/SignInTextField.d.ts +0 -26
  120. package/dist/esm/types/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.d.ts +0 -32
  121. package/dist/esm/types/oxygen-ui-react-auth-components/index.d.ts +0 -19
  122. package/dist/esm/types/providers/AsgardeoProvider.d.ts +0 -34
  123. package/dist/esm/types/providers/BrandingPreferenceProvider.d.ts +0 -32
  124. package/dist/esm/types/providers/I18nProvider.d.ts +0 -33
  125. package/dist/esm/types/theme/generate-theme-sign-in.d.ts +0 -28
  126. package/dist/esm/types/theme/generate-theme.d.ts +0 -30
  127. package/dist/esm/types/utils/crypto-utils.d.ts +0 -52
  128. package/dist/esm/types/utils/session-store.d.ts +0 -25
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
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
@@ -15,5 +15,5 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- export type { UIAuthConfig } from '@asgardeo/js';
19
- export { Hooks } from './use-on';
18
+ import { AsgardeoBrowserConfig } from '@asgardeo/browser';
19
+ export type AsgardeoReactConfig = AsgardeoBrowserConfig;
@@ -0,0 +1,51 @@
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 } 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;
51
+ export default getMappedUserProfileValue;
package/package.json CHANGED
@@ -1,80 +1,76 @@
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",
9
- "author": "WSO2",
10
- "license": "Apache-2.0",
11
- "files": [
12
- "dist",
13
- "LICENSE",
14
- "README.md"
3
+ "version": "0.4.0",
4
+ "description": "React implementation of Asgardeo JavaScript SDK.",
5
+ "keywords": [
6
+ "asgardeo",
7
+ "react",
8
+ "spa"
15
9
  ],
16
10
  "homepage": "https://github.com/asgardeo/web-ui-sdks/tree/main/packages/react#readme",
17
11
  "bugs": {
18
12
  "url": "https://github.com/asgardeo/web-ui-sdks/issues"
19
13
  },
14
+ "author": "WSO2",
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
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "types": "dist/index.d.ts",
20
29
  "repository": {
21
30
  "type": "git",
22
31
  "url": "https://github.com/asgardeo/web-ui-sdks",
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
+ "@floating-ui/react": "^0.27.12",
57
+ "@types/react-dom": "^19.1.5",
66
58
  "clsx": "^2.1.1",
67
- "fast-sha256": "^1.3.0",
68
- "jose": "^5.3.0",
69
- "randombytes": "^2.1.0"
59
+ "esbuild": "^0.25.4",
60
+ "react-dom": "^19.1.0",
61
+ "tslib": "^2.8.1",
62
+ "@asgardeo/browser": "^0.1.0"
70
63
  },
71
- "peerDependencies": {
72
- "react": ">=18.0.0",
73
- "react-dom": ">=18.0.0"
64
+ "publishConfig": {
65
+ "access": "public"
74
66
  },
75
67
  "scripts": {
76
- "build": "rollup -c",
77
- "lint": "eslint .",
78
- "lint:fix": "eslint . --fix"
68
+ "build": "pnpm clean && node esbuild.config.mjs && tsc -p tsconfig.lib.json --emitDeclarationOnly --outDir dist",
69
+ "clean": "rimraf dist",
70
+ "fix:lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
71
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
72
+ "test": "vitest",
73
+ "test:browser": "vitest --workspace=vitest.workspace.ts",
74
+ "typecheck": "tsc -p tsconfig.lib.json"
79
75
  }
80
76
  }