@aarhus-university/au-lib-react-components 11.3.0 → 11.3.2
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/package.json +2 -2
- package/src/lib/context.tsx +1 -0
- package/src/lib/portals.tsx +18 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "@aarhus-university/au-lib-react-components",
|
|
4
|
-
"version": "11.3.
|
|
4
|
+
"version": "11.3.2",
|
|
5
5
|
"description": "Library for shared React components for various applications on au.dk",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@aarhus-university/au-designsystem-delphinus": "0.34.8",
|
|
76
76
|
"@aarhus-university/au-designsystem-delphinus-dev": "0.2.0",
|
|
77
|
-
"@aarhus-university/types": "^0.17.
|
|
77
|
+
"@aarhus-university/types": "^0.17.11",
|
|
78
78
|
"@reduxjs/toolkit": "^1.8.3",
|
|
79
79
|
"@types/google.analytics": "^0.0.42",
|
|
80
80
|
"@types/history": "^5.0.0",
|
package/src/lib/context.tsx
CHANGED
package/src/lib/portals.tsx
CHANGED
|
@@ -13,9 +13,11 @@ declare global {
|
|
|
13
13
|
IMPERSONATE_AUID: string;
|
|
14
14
|
IMPERSONATE_VALUE: string;
|
|
15
15
|
IMPERSONATE_TYPE: string;
|
|
16
|
-
PHASE:
|
|
17
|
-
REAL_PHASE:
|
|
16
|
+
PHASE: number;
|
|
17
|
+
REAL_PHASE: number;
|
|
18
18
|
authenticated: boolean;
|
|
19
|
+
userContext: AU.IUserContext;
|
|
20
|
+
impersonateError: boolean;
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -101,3 +103,17 @@ export const getPortalByName = (
|
|
|
101
103
|
lang: string,
|
|
102
104
|
name: string,
|
|
103
105
|
): AU.IPortalContext | null => portals(lang).find((portal) => portal.name === name) ?? null;
|
|
106
|
+
|
|
107
|
+
export const impersonationPortalElement = document.querySelector('.page__pre-header');
|
|
108
|
+
|
|
109
|
+
export const isImpersonating = (): boolean => {
|
|
110
|
+
if (window.userContext == null) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (window.userContext.impersonatedUser == null) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const impersonationHasErrored = (): boolean => window.impersonateError;
|