@telia/teddy 0.0.43 → 0.0.44

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.
@@ -256,7 +256,7 @@ const Desktop = React.forwardRef(() => {
256
256
  setHideMenu(false);
257
257
  }
258
258
  const { setSelectedMenuItem, linkComponent: Link } = rootContext;
259
- const currentLocation = rootContext.pathname;
259
+ const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
260
260
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
261
261
  /* @__PURE__ */ jsxRuntime.jsx(
262
262
  "div",
@@ -539,30 +539,34 @@ function Root({
539
539
  );
540
540
  }
541
541
  Root.displayName = "Root";
542
- function getInitialDomain(currentLocation) {
543
- if (!currentLocation)
542
+ function getInitialDomain(currentPath) {
543
+ if (!currentPath)
544
544
  return components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
545
- const locationArray = currentLocation ? currentLocation.split("/") : [];
545
+ const locationArray = currentPath ? currentPath.split("/") : [];
546
546
  const domainPartOfLocation = `/${locationArray[1].toLowerCase()}/`;
547
547
  const initDomain = domainPartOfLocation === components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.link ? components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.name : domainPartOfLocation === components_navigationMenu_globalNavigation_utils.MDU_LINKS.link ? components_navigationMenu_globalNavigation_utils.MDU_LINKS.name : components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
548
548
  return initDomain;
549
549
  }
550
- function getInitialMenuItem(currentLocation) {
550
+ function getInitialMenuItem(currentPath) {
551
551
  var _a, _b, _c;
552
- if (!currentLocation)
552
+ if (!currentPath)
553
553
  return;
554
- const locationArray = currentLocation ? currentLocation.split("/") : [];
555
- const initialDomain = getInitialDomain(currentLocation);
554
+ const locationArray = currentPath ? currentPath.split("/") : [];
555
+ const initialDomain = getInitialDomain(currentPath);
556
556
  if (initialDomain === "Bedrift") {
557
557
  const mainMenuPartOfLocation2 = locationArray[2];
558
- return (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _a.name;
558
+ return (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links.find(
559
+ (link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || link.links.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)
560
+ )) == null ? void 0 : _a.name;
559
561
  }
560
562
  if (initialDomain === "Borettslag") {
561
563
  const mainMenuPartOfLocation2 = locationArray[2];
562
564
  return (_b = components_navigationMenu_globalNavigation_utils.MDU_LINKS.links.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _b.name;
563
565
  }
564
566
  const mainMenuPartOfLocation = locationArray[1];
565
- return (_c = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links.find((link) => link.link === `/${mainMenuPartOfLocation}/`)) == null ? void 0 : _c.name;
567
+ return (_c = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links.find((link) => {
568
+ return link.link === `/${mainMenuPartOfLocation}/` || link.links.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`);
569
+ })) == null ? void 0 : _c.name;
566
570
  }
567
571
  Root.displayName = "GlobalNavigation";
568
572
  const GlobalNavigation = Root;
@@ -254,7 +254,7 @@ const Desktop = React__default.forwardRef(() => {
254
254
  setHideMenu(false);
255
255
  }
256
256
  const { setSelectedMenuItem, linkComponent: Link2 } = rootContext;
257
- const currentLocation = rootContext.pathname;
257
+ const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
258
258
  return /* @__PURE__ */ jsxs(Fragment, { children: [
259
259
  /* @__PURE__ */ jsx(
260
260
  "div",
@@ -537,30 +537,34 @@ function Root({
537
537
  );
538
538
  }
539
539
  Root.displayName = "Root";
540
- function getInitialDomain(currentLocation) {
541
- if (!currentLocation)
540
+ function getInitialDomain(currentPath) {
541
+ if (!currentPath)
542
542
  return PRIVATE_LINKS.name;
543
- const locationArray = currentLocation ? currentLocation.split("/") : [];
543
+ const locationArray = currentPath ? currentPath.split("/") : [];
544
544
  const domainPartOfLocation = `/${locationArray[1].toLowerCase()}/`;
545
545
  const initDomain = domainPartOfLocation === BUSINESS_LINKS.link ? BUSINESS_LINKS.name : domainPartOfLocation === MDU_LINKS.link ? MDU_LINKS.name : PRIVATE_LINKS.name;
546
546
  return initDomain;
547
547
  }
548
- function getInitialMenuItem(currentLocation) {
548
+ function getInitialMenuItem(currentPath) {
549
549
  var _a, _b, _c;
550
- if (!currentLocation)
550
+ if (!currentPath)
551
551
  return;
552
- const locationArray = currentLocation ? currentLocation.split("/") : [];
553
- const initialDomain = getInitialDomain(currentLocation);
552
+ const locationArray = currentPath ? currentPath.split("/") : [];
553
+ const initialDomain = getInitialDomain(currentPath);
554
554
  if (initialDomain === "Bedrift") {
555
555
  const mainMenuPartOfLocation2 = locationArray[2];
556
- return (_a = BUSINESS_LINKS.links.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _a.name;
556
+ return (_a = BUSINESS_LINKS.links.find(
557
+ (link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || link.links.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)
558
+ )) == null ? void 0 : _a.name;
557
559
  }
558
560
  if (initialDomain === "Borettslag") {
559
561
  const mainMenuPartOfLocation2 = locationArray[2];
560
562
  return (_b = MDU_LINKS.links.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _b.name;
561
563
  }
562
564
  const mainMenuPartOfLocation = locationArray[1];
563
- return (_c = PRIVATE_LINKS.links.find((link) => link.link === `/${mainMenuPartOfLocation}/`)) == null ? void 0 : _c.name;
565
+ return (_c = PRIVATE_LINKS.links.find((link) => {
566
+ return link.link === `/${mainMenuPartOfLocation}/` || link.links.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`);
567
+ })) == null ? void 0 : _c.name;
564
568
  }
565
569
  Root.displayName = "GlobalNavigation";
566
570
  const GlobalNavigation = Root;
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=8"
21
21
  },
22
22
  "private": false,
23
- "version": "0.0.43",
23
+ "version": "0.0.44",
24
24
  "sideEffects": [
25
25
  "**/*.css"
26
26
  ],