@uxland/primary-shell 7.13.1 → 7.14.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/dist/{component-C26_oeb6.js → component-B25VrLkq.js} +2 -2
- package/dist/{component-C26_oeb6.js.map → component-B25VrLkq.js.map} +1 -1
- package/dist/{index-BzY8_3e-.js → index-DdsMjYI8.js} +536 -526
- package/dist/index-DdsMjYI8.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/api/user-manager/user-manager.d.ts +2 -0
- package/dist/primary/shell/src/index.d.ts +5 -0
- package/package.json +1 -1
- package/src/api/user-manager/user-manager.ts +28 -2
- package/src/index.ts +11 -3
- package/dist/index-BzY8_3e-.js.map +0 -1
|
@@ -2,11 +2,13 @@ import { TokenManager } from '../token-manager/token-manager';
|
|
|
2
2
|
export interface UserManager {
|
|
3
3
|
getRole: () => string | undefined;
|
|
4
4
|
isUserRoleAdministrative: () => boolean;
|
|
5
|
+
getFullName: () => string | undefined;
|
|
5
6
|
}
|
|
6
7
|
export declare class UserManagerImpl implements UserManager {
|
|
7
8
|
private tokenManager;
|
|
8
9
|
constructor(tokenManager: TokenManager);
|
|
9
10
|
getRole: () => string | undefined;
|
|
10
11
|
isUserRoleAdministrative: () => boolean;
|
|
12
|
+
getFullName: () => string | undefined;
|
|
11
13
|
}
|
|
12
14
|
export declare const createUserManager: (tokenManager: TokenManager) => UserManager;
|
|
@@ -12,3 +12,8 @@ export * from '@uxland/harmonix-adapters';
|
|
|
12
12
|
export * from './api/interaction-service';
|
|
13
13
|
export type { IUserInfo } from './features/get-user-info/model';
|
|
14
14
|
export type { IActivityHistoryItem } from '../../../plugins/activity-history/src/activity-history-item/domain/model';
|
|
15
|
+
export type { InjectAsyncHistoryItemsPayload } from '../../../plugins/activity-history/src/activity-history-item/add/add-async-history-items/request';
|
|
16
|
+
export type { AddHistoryItemPayload } from '../../../plugins/activity-history/src/activity-history-item/add/add-history-item/request';
|
|
17
|
+
export type { AddHistoryItemsPayload } from '../../../plugins/activity-history/src/activity-history-item/add/add-history-items/request';
|
|
18
|
+
export type { ActivityHistoryFilterType } from '../../../plugins/activity-history/src/activity-history-item/filter/model';
|
|
19
|
+
export type { IActivityHistoryCustomFilterGroup, IActivityHistoryCustomFilter, } from '../../../plugins/activity-history/src/activity-history-item/filter/model';
|
package/package.json
CHANGED
|
@@ -4,12 +4,15 @@ import { TokenManager } from "../token-manager/token-manager";
|
|
|
4
4
|
interface JWTPayload {
|
|
5
5
|
access_info?: {
|
|
6
6
|
role_type?: string;
|
|
7
|
+
trace_user_given_name?: string;
|
|
8
|
+
trace_user_family_name?: string;
|
|
7
9
|
};
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export interface UserManager {
|
|
11
13
|
getRole: () => string | undefined;
|
|
12
14
|
isUserRoleAdministrative: () => boolean;
|
|
15
|
+
getFullName: () => string | undefined;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export class UserManagerImpl implements UserManager {
|
|
@@ -20,7 +23,7 @@ export class UserManagerImpl implements UserManager {
|
|
|
20
23
|
if (!token) {
|
|
21
24
|
return undefined;
|
|
22
25
|
}
|
|
23
|
-
|
|
26
|
+
|
|
24
27
|
try {
|
|
25
28
|
const payload = jwtDecode<JWTPayload>(token);
|
|
26
29
|
const role = payload.access_info?.role_type;
|
|
@@ -35,6 +38,29 @@ export class UserManagerImpl implements UserManager {
|
|
|
35
38
|
const userRole = this.getRole();
|
|
36
39
|
return userRole === "ADM";
|
|
37
40
|
};
|
|
41
|
+
|
|
42
|
+
getFullName = (): string | undefined => {
|
|
43
|
+
const token = this.tokenManager.getToken();
|
|
44
|
+
if (!token) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const payload = jwtDecode<JWTPayload>(token);
|
|
50
|
+
const givenName = payload.access_info?.trace_user_given_name;
|
|
51
|
+
const familyName = payload.access_info?.trace_user_family_name;
|
|
52
|
+
|
|
53
|
+
if (!givenName && !familyName) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const fullName = [familyName, givenName].filter(Boolean).join(" ");
|
|
58
|
+
return fullName;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error("Error decoding JWT token:", error);
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
38
64
|
}
|
|
39
65
|
|
|
40
66
|
let userManager: UserManager;
|
|
@@ -42,4 +68,4 @@ export const createUserManager = (tokenManager: TokenManager): UserManager => {
|
|
|
42
68
|
if (userManager) return userManager;
|
|
43
69
|
userManager = new UserManagerImpl(tokenManager);
|
|
44
70
|
return userManager;
|
|
45
|
-
};
|
|
71
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -3,9 +3,9 @@ import fontsCSS from "./UI/fonts/fonts.css?inline";
|
|
|
3
3
|
import dssCSS from "@salut/design-system-salut/css/main.css?inline";
|
|
4
4
|
|
|
5
5
|
// Inject CSS automatically
|
|
6
|
-
if (typeof document !==
|
|
7
|
-
const style = document.createElement(
|
|
8
|
-
style.textContent = fontsCSS +
|
|
6
|
+
if (typeof document !== "undefined") {
|
|
7
|
+
const style = document.createElement("style");
|
|
8
|
+
style.textContent = fontsCSS + "\n" + dssCSS;
|
|
9
9
|
document.head.appendChild(style);
|
|
10
10
|
}
|
|
11
11
|
export * from "./bootstrapper";
|
|
@@ -25,3 +25,11 @@ export * from "@uxland/harmonix-adapters";
|
|
|
25
25
|
export * from "./api/interaction-service";
|
|
26
26
|
export type { IUserInfo } from "./features/get-user-info/model";
|
|
27
27
|
export type { IActivityHistoryItem } from "../../../plugins/activity-history/src/activity-history-item/domain/model";
|
|
28
|
+
export type { InjectAsyncHistoryItemsPayload } from "../../../plugins/activity-history/src/activity-history-item/add/add-async-history-items/request";
|
|
29
|
+
export type { AddHistoryItemPayload } from "../../../plugins/activity-history/src/activity-history-item/add/add-history-item/request";
|
|
30
|
+
export type { AddHistoryItemsPayload } from "../../../plugins/activity-history/src/activity-history-item/add/add-history-items/request";
|
|
31
|
+
export type { ActivityHistoryFilterType } from "../../../plugins/activity-history/src/activity-history-item/filter/model";
|
|
32
|
+
export type {
|
|
33
|
+
IActivityHistoryCustomFilterGroup,
|
|
34
|
+
IActivityHistoryCustomFilter,
|
|
35
|
+
} from "../../../plugins/activity-history/src/activity-history-item/filter/model";
|