@keycloakify/keycloak-account-ui 25.0.1-rc.9 → 25.0.2-rc.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.
- package/KcAccountUiLoader.d.ts +0 -2
- package/KcAccountUiLoader.js +33 -11
- package/KcAccountUiLoader.js.map +1 -1
- package/README.md +10 -10
- package/package.json +6 -6
- package/public/content.d.ts +1 -1
- package/public/content.js +1 -1
- package/public/content.js.map +1 -1
- package/root/PageNav.d.ts +2 -3
- package/root/PageNav.js +8 -5
- package/root/PageNav.js.map +1 -1
- package/src/KcAccountUiLoader.tsx +45 -17
- package/src/public/content.ts +1 -1
- package/src/root/PageNav.tsx +10 -7
package/KcAccountUiLoader.d.ts
CHANGED
package/KcAccountUiLoader.js
CHANGED
|
@@ -33,7 +33,7 @@ function init(params) {
|
|
|
33
33
|
var _a, _b;
|
|
34
34
|
exit_condition: {
|
|
35
35
|
const paramsFingerprint = JSON.stringify(params);
|
|
36
|
-
if (
|
|
36
|
+
if (previousRunParamsFingerprint === undefined) {
|
|
37
37
|
previousRunParamsFingerprint = paramsFingerprint;
|
|
38
38
|
break exit_condition;
|
|
39
39
|
}
|
|
@@ -43,12 +43,20 @@ function init(params) {
|
|
|
43
43
|
}
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
const { content = defaultContent, kcContext
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
url.
|
|
51
|
-
|
|
46
|
+
const { content = defaultContent, kcContext } = params;
|
|
47
|
+
const logoUrl = (() => {
|
|
48
|
+
var _a;
|
|
49
|
+
const logoUrl_params = (_a = params.logoUrl) !== null && _a !== void 0 ? _a : defaultLogoSvgUrl;
|
|
50
|
+
const url = new URL(logoUrl_params.startsWith("http")
|
|
51
|
+
? logoUrl_params
|
|
52
|
+
: joinPath(window.location.origin, logoUrl_params));
|
|
53
|
+
return url.href.substring(url.origin.length);
|
|
54
|
+
})();
|
|
55
|
+
const resourceUrl = kcContext.resourceUrl;
|
|
56
|
+
if (!logoUrl.startsWith(resourceUrl)) {
|
|
57
|
+
const error = new Error(`ERROR: The logo url can't be an external url.`);
|
|
58
|
+
alert(error.message);
|
|
59
|
+
throw error;
|
|
52
60
|
}
|
|
53
61
|
const environment = {
|
|
54
62
|
serverBaseUrl: kcContext.serverBaseUrl,
|
|
@@ -56,13 +64,13 @@ function init(params) {
|
|
|
56
64
|
authServerUrl: kcContext.authServerUrl,
|
|
57
65
|
realm: kcContext.realm.name,
|
|
58
66
|
clientId: kcContext.clientId,
|
|
59
|
-
resourceUrl
|
|
60
|
-
logo:
|
|
67
|
+
resourceUrl,
|
|
68
|
+
logo: logoUrl.substring(resourceUrl.length),
|
|
61
69
|
logoUrl: logoUrl,
|
|
62
70
|
baseUrl: `${kcContext.baseUrl.scheme}:${kcContext.baseUrl.rawSchemeSpecificPart}`,
|
|
63
71
|
locale: kcContext.locale,
|
|
64
|
-
referrerName: (_a =
|
|
65
|
-
referrerUrl: (_b =
|
|
72
|
+
referrerName: (_a = readQueryParamOrRestoreFromSessionStorage({ name: "referrer" })) !== null && _a !== void 0 ? _a : "",
|
|
73
|
+
referrerUrl: (_b = readQueryParamOrRestoreFromSessionStorage({ name: "referrer_uri" })) !== null && _b !== void 0 ? _b : "",
|
|
66
74
|
features: {
|
|
67
75
|
isRegistrationEmailAsUsername: kcContext.realm.registrationEmailAsUsername,
|
|
68
76
|
isEditUserNameAllowed: kcContext.realm.editUsernameAllowed,
|
|
@@ -96,4 +104,18 @@ function init(params) {
|
|
|
96
104
|
return realFetch(...args);
|
|
97
105
|
};
|
|
98
106
|
}
|
|
107
|
+
function readQueryParamOrRestoreFromSessionStorage(params) {
|
|
108
|
+
var _a;
|
|
109
|
+
const { name } = params;
|
|
110
|
+
const url = new URL(window.location.href);
|
|
111
|
+
const value = url.searchParams.get(name);
|
|
112
|
+
const PREFIX = "keycloakify:";
|
|
113
|
+
if (value !== null) {
|
|
114
|
+
sessionStorage.setItem(`${PREFIX}${name}`, value);
|
|
115
|
+
url.searchParams.delete(name);
|
|
116
|
+
window.history.replaceState({}, "", url.toString());
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
return (_a = sessionStorage.getItem(`${PREFIX}${name}`)) !== null && _a !== void 0 ? _a : undefined;
|
|
120
|
+
}
|
|
99
121
|
//# sourceMappingURL=KcAccountUiLoader.js.map
|
package/KcAccountUiLoader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KcAccountUiLoader.js","sourceRoot":"","sources":["src/KcAccountUiLoader.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAA4B,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"KcAccountUiLoader.js","sourceRoot":"","sources":["src/KcAccountUiLoader.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAA4B,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,iBAAiB,MAAM,kDAAkD,CAAC;AAyCjF,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,WAAW,EAAE,eAAe,KAAsB,KAAK,EAAtB,YAAY,UAAK,KAAK,EAAzD,kCAAiD,CAAQ,C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AAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE1C,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEzC,MAAM,MAAM,GAAG,cAAc,CAAC;IAE9B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,cAAc,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAClD,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,MAAA,cAAc,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,mCAAI,SAAS,CAAC;AACjE,CAAC"}
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<a href="https://github.com/keycloakify/keycloak-account-ui/actions">
|
|
9
9
|
<img src="https://github.com/keycloakify/keycloak-account-ui/actions/workflows/ci.yaml/badge.svg?branch=main">
|
|
10
10
|
</a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@keycloakify/keycloak-account-ui/v/25.0.
|
|
11
|
+
<a href="https://www.npmjs.com/package/@keycloakify/keycloak-account-ui/v/25.0.2-rc.1">
|
|
12
12
|
<img src="https://img.shields.io/npm/dm/@keycloakify/keycloak-account-ui">
|
|
13
13
|
</a>
|
|
14
14
|
<p align="center">
|
|
@@ -26,19 +26,19 @@ All credits goes to the keycloak team for the original work. Mainly [@jonkoops
|
|
|
26
26
|
This re-packaged distribution exists to make it possible to take ownership of
|
|
27
27
|
some specific part of the Account UI to create your own custom version of it.
|
|
28
28
|
In straight forward therms it make the Account UI ejectable, you can copy
|
|
29
|
-
past [the source files](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.
|
|
29
|
+
past [the source files](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.2-rc.1/src/) that you want to modify into your codebase.
|
|
30
30
|
|
|
31
31
|
For more details on integrating this package into your project, refer to the [Keycloakify documentation](https://keycloakify.dev).
|
|
32
32
|
|
|
33
33
|
> **Note:** This package's GitHub repository does not contain any code as it is automatically generated at build time by [scripts/prepare.ts](/scripts/prepare.ts).
|
|
34
|
-
> You can browse the sources includes int the NPM package [here](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.
|
|
34
|
+
> You can browse the sources includes int the NPM package [here](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.2-rc.1/src/).
|
|
35
35
|
|
|
36
36
|
## Installation
|
|
37
37
|
|
|
38
38
|
> **Note:** This README file is automatically generated at build so the information above are guaranteed to be up to date.
|
|
39
|
-
> You are currently viewing the README of [`@keycloakify/keycloak-account-ui@25.0.
|
|
40
|
-
> mirrors [`@keycloak/keycloak-account-ui@25.0.
|
|
41
|
-
> It is the version of the Account UI that ships with [**Keycloak 25.0.
|
|
39
|
+
> You are currently viewing the README of [`@keycloakify/keycloak-account-ui@25.0.2-rc.1`](https://www.npmjs.com/package/@keycloakify/keycloak-account-ui/v/25.0.2-rc.1) that
|
|
40
|
+
> mirrors [`@keycloak/keycloak-account-ui@25.0.2`](https://www.npmjs.com/package/@keycloak/keycloak-account-ui/v/25.0.2).
|
|
41
|
+
> It is the version of the Account UI that ships with [**Keycloak 25.0.2**](https://github.com/keycloak/keycloak/tree/25.0.2/js/apps/account-ui).
|
|
42
42
|
|
|
43
43
|
Here are all the dependencies that are required to use the Account UI in your project.
|
|
44
44
|
It's important to respect the exact version range listed here to avoid any compatibility issues.
|
|
@@ -48,7 +48,7 @@ It's important to respect the exact version range listed here to avoid any compa
|
|
|
48
48
|
```json
|
|
49
49
|
{
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@keycloakify/keycloak-account-ui": "25.0.
|
|
51
|
+
"@keycloakify/keycloak-account-ui": "25.0.2-rc.1",
|
|
52
52
|
"@patternfly/patternfly": "^5.3.1",
|
|
53
53
|
"@patternfly/react-core": "^5.3.3",
|
|
54
54
|
"@patternfly/react-icons": "^5.3.2",
|
|
@@ -59,9 +59,9 @@ It's important to respect the exact version range listed here to avoid any compa
|
|
|
59
59
|
"react-hook-form": "7.51.5",
|
|
60
60
|
"react-i18next": "^14.1.2",
|
|
61
61
|
"react-router-dom": "^6.23.1",
|
|
62
|
-
"keycloak-js": "25.0.
|
|
62
|
+
"keycloak-js": "25.0.2",
|
|
63
63
|
"@patternfly/react-styles": "^5.3.1",
|
|
64
|
-
"@keycloak/keycloak-admin-client": "25.0.
|
|
64
|
+
"@keycloak/keycloak-admin-client": "25.0.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/lodash-es": "^4.17.12"
|
|
@@ -72,4 +72,4 @@ It's important to respect the exact version range listed here to avoid any compa
|
|
|
72
72
|
## Ejecting
|
|
73
73
|
|
|
74
74
|
You can take partial ownership of some parts of the Account UI by copy pasting the sources files you want to modify into your codebase.
|
|
75
|
-
You can browse the sources files **[here](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.
|
|
75
|
+
You can browse the sources files **[here](https://unpkg.com/browse/@keycloakify/keycloak-account-ui@25.0.2-rc.1/src/)**.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keycloakify/keycloak-account-ui",
|
|
3
|
-
"version": "25.0.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "25.0.2-rc.1",
|
|
4
|
+
"description": "Repackaged Keycloak Account UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git://github.com/keycloakify/keycloak-account-ui.git"
|
|
@@ -397,9 +397,9 @@
|
|
|
397
397
|
"react-hook-form": "7.51.5",
|
|
398
398
|
"react-i18next": "^14.1.2",
|
|
399
399
|
"react-router-dom": "^6.23.1",
|
|
400
|
-
"keycloak-js": "25.0.
|
|
400
|
+
"keycloak-js": "25.0.2",
|
|
401
401
|
"@patternfly/react-styles": "^5.3.1",
|
|
402
|
-
"@keycloak/keycloak-admin-client": "25.0.
|
|
402
|
+
"@keycloak/keycloak-admin-client": "25.0.2"
|
|
403
403
|
},
|
|
404
404
|
"devDependencies": {
|
|
405
405
|
"react": "^18.3.1",
|
|
@@ -431,9 +431,9 @@
|
|
|
431
431
|
"react-hook-form": "7.51.5",
|
|
432
432
|
"react-i18next": "^14.1.2",
|
|
433
433
|
"react-router-dom": "^6.23.1",
|
|
434
|
-
"keycloak-js": "25.0.
|
|
434
|
+
"keycloak-js": "25.0.2",
|
|
435
435
|
"@patternfly/react-styles": "^5.3.1",
|
|
436
|
-
"@keycloak/keycloak-admin-client": "25.0.
|
|
436
|
+
"@keycloak/keycloak-admin-client": "25.0.2"
|
|
437
437
|
},
|
|
438
438
|
"dependencies": {
|
|
439
439
|
"tsafe": "^1.7.2"
|
package/public/content.d.ts
CHANGED
package/public/content.js
CHANGED
package/public/content.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../src/public/content.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;IACd;QACE,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../src/public/content.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;IACd;QACE,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,EAAE;KACX;IACD;QACE,OAAO,EAAE,iBAAiB;QAC1B,UAAU,EAAE;YACV;gBACE,OAAO,EAAE,WAAW;gBACpB,MAAM,EAAE,6BAA6B;aACtC;YACD;gBACE,OAAO,EAAE,gBAAgB;gBACzB,MAAM,EAAE,kCAAkC;aAC3C;YACD;gBACE,OAAO,EAAE,gBAAgB;gBACzB,MAAM,EAAE,kCAAkC;gBAC1C,WAAW,EAAE,yBAAyB;aACvC;SACF;KACF;IACD;QACE,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,cAAc;KACvB;IACD;QACE,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE,QAAQ;QAChB,WAAW,EAAE,qBAAqB;KACnC;IACD;QACE,OAAO,EAAE,WAAW;QACpB,MAAM,EAAE,WAAW;QACnB,WAAW,EAAE,sBAAsB;KACpC;IACD;QACE,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;QACjB,WAAW,EAAE,kBAAkB;KAChC;CACO,CAAC;AACX,eAAe,OAAO,CAAC"}
|
package/root/PageNav.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
|
-
import { To } from "react-router-dom";
|
|
3
2
|
import { type Feature } from "../environment";
|
|
4
3
|
import { TFuncKey } from "../i18n";
|
|
5
4
|
type RootMenuItem = {
|
|
@@ -16,8 +15,8 @@ type MenuItemWithChildren = {
|
|
|
16
15
|
export type MenuItem = RootMenuItem | MenuItemWithChildren;
|
|
17
16
|
export declare const PageNav: () => import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
type NavLinkProps = {
|
|
19
|
-
|
|
18
|
+
path: string;
|
|
20
19
|
isActive: boolean;
|
|
21
20
|
};
|
|
22
|
-
export declare const NavLink: ({
|
|
21
|
+
export declare const NavLink: ({ path, isActive, children, }: PropsWithChildren<NavLinkProps>) => import("react/jsx-runtime").JSX.Element;
|
|
23
22
|
export {};
|
package/root/PageNav.js
CHANGED
|
@@ -21,23 +21,26 @@ function NavMenuItem({ menuItem }) {
|
|
|
21
21
|
const { pathname } = useLocation();
|
|
22
22
|
const isActive = useMemo(() => matchMenuItem(pathname, menuItem), [pathname, menuItem]);
|
|
23
23
|
if ("path" in menuItem) {
|
|
24
|
-
return (_jsx(NavLink, {
|
|
24
|
+
return (_jsx(NavLink, { path: menuItem.path, isActive: isActive, children: t(menuItem.label) }));
|
|
25
25
|
}
|
|
26
26
|
return (_jsx(NavExpandable, { "data-testid": menuItem.label, title: t(menuItem.label), isActive: isActive, isExpanded: isActive, children: menuItem.children
|
|
27
27
|
.filter((menuItem) => menuItem.isVisible ? features[menuItem.isVisible] : true)
|
|
28
28
|
.map((child) => (_jsx(NavMenuItem, { menuItem: child }, child.label))) }));
|
|
29
29
|
}
|
|
30
|
+
function getFullUrl(path) {
|
|
31
|
+
return `${new URL(environment.baseUrl).pathname}${path}`;
|
|
32
|
+
}
|
|
30
33
|
function matchMenuItem(currentPath, menuItem) {
|
|
31
34
|
if ("path" in menuItem) {
|
|
32
|
-
return !!matchPath(menuItem.path, currentPath);
|
|
35
|
+
return !!matchPath(getFullUrl(menuItem.path), currentPath);
|
|
33
36
|
}
|
|
34
37
|
return menuItem.children.some((child) => matchMenuItem(currentPath, child));
|
|
35
38
|
}
|
|
36
|
-
export const NavLink = ({
|
|
37
|
-
const menuItemPath =
|
|
39
|
+
export const NavLink = ({ path, isActive, children, }) => {
|
|
40
|
+
const menuItemPath = getFullUrl(path);
|
|
38
41
|
const href = useHref(menuItemPath);
|
|
39
42
|
const handleClick = useLinkClickHandler(menuItemPath);
|
|
40
|
-
return (_jsx(NavItem, { "data-testid":
|
|
43
|
+
return (_jsx(NavItem, { "data-testid": path, to: href, isActive: isActive, onClick: (event) =>
|
|
41
44
|
// PatternFly does not have the correct type for this event, so we need to cast it.
|
|
42
45
|
handleClick(event), children: children }));
|
|
43
46
|
};
|
package/root/PageNav.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageNav.js","sourceRoot":"","sources":["../src/root/PageNav.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EACL,GAAG,EACH,aAAa,EACb,OAAO,EACP,OAAO,EACP,WAAW,EACX,eAAe,EACf,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAA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: string;
|
|
29
|
-
referrerName?: string;
|
|
30
|
-
referrer_uri?: string;
|
|
31
29
|
isAuthorizationEnabled: boolean;
|
|
32
30
|
deleteAccountAllowed: boolean;
|
|
33
31
|
updateEmailFeatureEnabled: boolean;
|
|
@@ -78,7 +76,7 @@ function init(
|
|
|
78
76
|
exit_condition: {
|
|
79
77
|
const paramsFingerprint = JSON.stringify(params);
|
|
80
78
|
|
|
81
|
-
if (
|
|
79
|
+
if (previousRunParamsFingerprint === undefined) {
|
|
82
80
|
previousRunParamsFingerprint = paramsFingerprint;
|
|
83
81
|
break exit_condition;
|
|
84
82
|
}
|
|
@@ -91,19 +89,26 @@ function init(
|
|
|
91
89
|
return;
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
const {
|
|
95
|
-
content = defaultContent,
|
|
96
|
-
kcContext,
|
|
97
|
-
logoUrl = defaultLogoSvgUrl,
|
|
98
|
-
} = params;
|
|
92
|
+
const { content = defaultContent, kcContext } = params;
|
|
99
93
|
|
|
100
|
-
{
|
|
101
|
-
const
|
|
94
|
+
const logoUrl = (() => {
|
|
95
|
+
const logoUrl_params = params.logoUrl ?? defaultLogoSvgUrl;
|
|
102
96
|
|
|
103
|
-
url
|
|
104
|
-
|
|
97
|
+
const url = new URL(
|
|
98
|
+
logoUrl_params.startsWith("http")
|
|
99
|
+
? logoUrl_params
|
|
100
|
+
: joinPath(window.location.origin, logoUrl_params),
|
|
101
|
+
);
|
|
105
102
|
|
|
106
|
-
|
|
103
|
+
return url.href.substring(url.origin.length);
|
|
104
|
+
})();
|
|
105
|
+
|
|
106
|
+
const resourceUrl = kcContext.resourceUrl;
|
|
107
|
+
|
|
108
|
+
if (!logoUrl.startsWith(resourceUrl)) {
|
|
109
|
+
const error = new Error(`ERROR: The logo url can't be an external url.`);
|
|
110
|
+
alert(error.message);
|
|
111
|
+
throw error;
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
const environment = {
|
|
@@ -112,13 +117,15 @@ function init(
|
|
|
112
117
|
authServerUrl: kcContext.authServerUrl,
|
|
113
118
|
realm: kcContext.realm.name,
|
|
114
119
|
clientId: kcContext.clientId,
|
|
115
|
-
resourceUrl
|
|
116
|
-
logo:
|
|
120
|
+
resourceUrl,
|
|
121
|
+
logo: logoUrl.substring(resourceUrl.length),
|
|
117
122
|
logoUrl: logoUrl,
|
|
118
123
|
baseUrl: `${kcContext.baseUrl.scheme}:${kcContext.baseUrl.rawSchemeSpecificPart}`,
|
|
119
124
|
locale: kcContext.locale,
|
|
120
|
-
referrerName:
|
|
121
|
-
|
|
125
|
+
referrerName:
|
|
126
|
+
readQueryParamOrRestoreFromSessionStorage({ name: "referrer" }) ?? "",
|
|
127
|
+
referrerUrl:
|
|
128
|
+
readQueryParamOrRestoreFromSessionStorage({ name: "referrer_uri" }) ?? "",
|
|
122
129
|
features: {
|
|
123
130
|
isRegistrationEmailAsUsername:
|
|
124
131
|
kcContext.realm.registrationEmailAsUsername,
|
|
@@ -162,3 +169,24 @@ function init(
|
|
|
162
169
|
return realFetch(...args);
|
|
163
170
|
};
|
|
164
171
|
}
|
|
172
|
+
|
|
173
|
+
function readQueryParamOrRestoreFromSessionStorage(params: {
|
|
174
|
+
name: string;
|
|
175
|
+
}): string | undefined {
|
|
176
|
+
const { name } = params;
|
|
177
|
+
|
|
178
|
+
const url = new URL(window.location.href);
|
|
179
|
+
|
|
180
|
+
const value = url.searchParams.get(name);
|
|
181
|
+
|
|
182
|
+
const PREFIX = "keycloakify:";
|
|
183
|
+
|
|
184
|
+
if (value !== null) {
|
|
185
|
+
sessionStorage.setItem(`${PREFIX}${name}`, value);
|
|
186
|
+
url.searchParams.delete(name);
|
|
187
|
+
window.history.replaceState({}, "", url.toString());
|
|
188
|
+
return value;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return sessionStorage.getItem(`${PREFIX}${name}`) ?? undefined;
|
|
192
|
+
}
|
package/src/public/content.ts
CHANGED
package/src/root/PageNav.tsx
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
} from "react";
|
|
18
18
|
import { useTranslation } from "react-i18next";
|
|
19
19
|
import {
|
|
20
|
-
To,
|
|
21
20
|
matchPath,
|
|
22
21
|
useHref,
|
|
23
22
|
useLinkClickHandler,
|
|
@@ -92,7 +91,7 @@ function NavMenuItem({ menuItem }: NavMenuItemProps) {
|
|
|
92
91
|
|
|
93
92
|
if ("path" in menuItem) {
|
|
94
93
|
return (
|
|
95
|
-
<NavLink
|
|
94
|
+
<NavLink path={menuItem.path} isActive={isActive}>
|
|
96
95
|
{t(menuItem.label)}
|
|
97
96
|
</NavLink>
|
|
98
97
|
);
|
|
@@ -116,31 +115,35 @@ function NavMenuItem({ menuItem }: NavMenuItemProps) {
|
|
|
116
115
|
);
|
|
117
116
|
}
|
|
118
117
|
|
|
118
|
+
function getFullUrl(path: string) {
|
|
119
|
+
return `${new URL(environment.baseUrl).pathname}${path}`;
|
|
120
|
+
}
|
|
121
|
+
|
|
119
122
|
function matchMenuItem(currentPath: string, menuItem: MenuItem): boolean {
|
|
120
123
|
if ("path" in menuItem) {
|
|
121
|
-
return !!matchPath(menuItem.path, currentPath);
|
|
124
|
+
return !!matchPath(getFullUrl(menuItem.path), currentPath);
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
return menuItem.children.some((child) => matchMenuItem(currentPath, child));
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
type NavLinkProps = {
|
|
128
|
-
|
|
131
|
+
path: string;
|
|
129
132
|
isActive: boolean;
|
|
130
133
|
};
|
|
131
134
|
|
|
132
135
|
export const NavLink = ({
|
|
133
|
-
|
|
136
|
+
path,
|
|
134
137
|
isActive,
|
|
135
138
|
children,
|
|
136
139
|
}: PropsWithChildren<NavLinkProps>) => {
|
|
137
|
-
const menuItemPath =
|
|
140
|
+
const menuItemPath = getFullUrl(path);
|
|
138
141
|
const href = useHref(menuItemPath);
|
|
139
142
|
const handleClick = useLinkClickHandler(menuItemPath);
|
|
140
143
|
|
|
141
144
|
return (
|
|
142
145
|
<NavItem
|
|
143
|
-
data-testid={
|
|
146
|
+
data-testid={path}
|
|
144
147
|
to={href}
|
|
145
148
|
isActive={isActive}
|
|
146
149
|
onClick={(event) =>
|