Skip to content

fix(internet-header): add self admin url prop to override menu links #4936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: release/v8
Choose a base branch
from

Conversation

leagrdv
Copy link
Contributor

@leagrdv leagrdv commented Mar 12, 2025

📄 Description

In order to let users override the calculated menu links origin URL in the kpl login widget, a selfAdminOrigin prop has been added to the internet-header.

@leagrdv leagrdv requested a review from a team as a code owner March 12, 2025 16:11
@leagrdv leagrdv requested a review from gfellerph March 12, 2025 16:11
Copy link

changeset-bot bot commented Mar 12, 2025

🦋 Changeset detected

Latest commit: 3e59033

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@swisspost/internet-header Patch
@swisspost/design-system-documentation Patch
@swisspost/design-system-nextjs-integration Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Mar 12, 2025

Related Previews

leagrdv added 2 commits March 13, 2025 11:30
…ink-for-the-selfadmin-when-the-logouturl-is-not-the-same-domain-as-the-user-profile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the config is not hosted or served by the Design System, we can't alter it. Also, the system serving it is due to be deprecated, so it probably won't make sense to update it there either.

const url = getLocation(logoutURL());
originUrl = url.origin;

originUrl = platform.selfAdminOrigin ? platform.selfAdminOrigin : getLocation(logoutURL()).origin;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nitpick, but since it's available, could as well use the nullish coalescing operator here.

Suggested change
originUrl = platform.selfAdminOrigin ? platform.selfAdminOrigin : getLocation(logoutURL()).origin;
originUrl = platform.selfAdminOrigin ?? getLocation(logoutURL()).origin;

Comment on lines +107 to +114
* Overrides the logout-url provided by the portal config.
*/
@Prop() logoutUrl?: string;

/**
* Overrides the logout-url provided by the portal config.
*/
@Prop() selfAdminOrigin?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be a bit more specific here? These properties don't have the same effect and this comment will show up as type hint in project devs IDEs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants