@asgardeo/react 0.11.0 → 0.11.1

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.
@@ -21,29 +21,25 @@ import { User } from '@asgardeo/browser';
21
21
  *
22
22
  * @param mergedMappings - The merged attribute mappings.
23
23
  * @param user - The user object containing profile information.
24
+ * @param displayAttributes - Optional array of attribute keys or paths to try first.
25
+ * Each entry is resolved via `getMappedUserProfileValue`. The first non-empty
26
+ * value found is returned. If none resolve, the default fallback chain is used.
24
27
  *
25
28
  * @example
26
29
  * ```ts
27
- * const mergedMappings = {
28
- * firstName: ['name.givenName', 'given_name'],
29
- * lastName: ['name.familyName', 'family_name'],
30
- * username: ['userName', 'username', 'user_name'],
31
- * email: ['emails[0].value', 'email'],
32
- * name: ['name', 'fullName'],
33
- * };
34
- *
35
- * const user: User = {
36
- * id: '1',
37
- * name: 'John Doe',
38
- * email: 'john.doe@example.com',
39
- * };
40
- *
30
+ * // Default behavior — tries firstName+lastName, then username, email, name
41
31
  * const displayName = getDisplayName(mergedMappings, user);
32
+ *
33
+ * // Custom attributes — try 'nickname' first, then fall back to defaults
34
+ * const displayName = getDisplayName(mergedMappings, user, ['nickname']);
35
+ *
36
+ * // Multiple custom attributes
37
+ * const displayName = getDisplayName(mergedMappings, user, ['preferred_username', 'nickname']);
42
38
  * ```
43
39
  *
44
40
  * @returns The display name of the user.
45
41
  */
46
42
  declare const getDisplayName: (mergedMappings: {
47
43
  [key: string]: string | string[] | undefined;
48
- }, user: User) => string;
44
+ }, user: User, displayAttributes?: string[]) => string;
49
45
  export default getDisplayName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/react",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "React implementation of Asgardeo JavaScript SDK.",
5
5
  "keywords": [
6
6
  "asgardeo",
@@ -33,20 +33,19 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@testing-library/dom": "10.4.0",
36
+ "@testing-library/react": "16.3.0",
36
37
  "@types/node": "22.15.3",
37
38
  "@types/react": "19.1.5",
38
- "@vitest/browser": "3.1.3",
39
39
  "@wso2/eslint-plugin": "git+https://github.com/brionmario/wso2-ui-configs.git#a1fc6eb570653c999828aea9f5027cba06af4391&path:packages/eslint-plugin",
40
40
  "@wso2/prettier-config": "git+https://github.com/brionmario/wso2-ui-configs.git#a1fc6eb570653c999828aea9f5027cba06af4391&path:packages/prettier-config",
41
41
  "esbuild-plugin-preserve-directives": "0.0.11",
42
42
  "eslint": "8.57.0",
43
- "playwright": "1.55.1",
43
+ "jsdom": "26.1.0",
44
44
  "prettier": "2.6.2",
45
45
  "react": "19.1.4",
46
46
  "rimraf": "6.1.0",
47
47
  "typescript": "5.7.2",
48
- "vitest": "3.1.3",
49
- "vitest-browser-react": "0.1.1"
48
+ "vitest": "3.1.3"
50
49
  },
51
50
  "peerDependencies": {
52
51
  "@types/react": ">=19.1.5",
@@ -59,8 +58,8 @@
59
58
  "esbuild": "0.25.9",
60
59
  "react-dom": "19.1.4",
61
60
  "tslib": "2.8.1",
62
- "@asgardeo/i18n": "0.4.1",
63
- "@asgardeo/browser": "0.2.6"
61
+ "@asgardeo/i18n": "0.4.2",
62
+ "@asgardeo/browser": "0.2.7"
64
63
  },
65
64
  "publishConfig": {
66
65
  "access": "public"