@telia/teddy 0.7.13 → 0.7.15

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.
@@ -1095,7 +1095,16 @@ const MDU_LINKS = {
1095
1095
  }
1096
1096
  ]
1097
1097
  };
1098
- const getLinks = (ukko = false) => [PRIVATE_LINKS, ukko ? BUSINESS_UKKO_LINKS : BUSINESS_LINKS, MDU_LINKS];
1098
+ const DEFAULT_PRIVATE_LINKS = PRIVATE_LINKS;
1099
+ const DEFAULT_BUSINESS_LINKS = BUSINESS_LINKS;
1100
+ const DEFAULT_BUSINESS_UKKO_LINKS = BUSINESS_UKKO_LINKS;
1101
+ const DEFAULT_MDU_LINKS = MDU_LINKS;
1102
+ const getLinks = (ukko = false, customLinks) => {
1103
+ const privateLinks = (customLinks == null ? void 0 : customLinks.privateLinks) || DEFAULT_PRIVATE_LINKS;
1104
+ const businessLinks = ukko ? (customLinks == null ? void 0 : customLinks.businessUkkoLinks) || DEFAULT_BUSINESS_UKKO_LINKS : (customLinks == null ? void 0 : customLinks.businessLinks) || DEFAULT_BUSINESS_LINKS;
1105
+ const mduLinks = (customLinks == null ? void 0 : customLinks.mduLinks) || DEFAULT_MDU_LINKS;
1106
+ return [privateLinks, businessLinks, mduLinks];
1107
+ };
1099
1108
  const getActiveSubLink = (path, links) => {
1100
1109
  let activeLink = "";
1101
1110
  links.forEach((link) => {
@@ -1110,6 +1119,10 @@ export {
1110
1119
  BUSINESS_LINKS,
1111
1120
  BUSINESS_NET_LINKS,
1112
1121
  BUSINESS_UKKO_LINKS,
1122
+ DEFAULT_BUSINESS_LINKS,
1123
+ DEFAULT_BUSINESS_UKKO_LINKS,
1124
+ DEFAULT_MDU_LINKS,
1125
+ DEFAULT_PRIVATE_LINKS,
1113
1126
  LOGGED_IN_LINKS,
1114
1127
  LOGGED_IN_LINKS_BUSINESS,
1115
1128
  MDU_LINKS,
@@ -781,23 +781,20 @@ ShoppingCart.displayName = "ShoppingCart";
781
781
  const Desktop = React.forwardRef(() => {
782
782
  const rootContext = React.useContext(RootContext);
783
783
  const [showMenu, setShowMenu] = React.useState(false);
784
+ const [isClientSide, setIsClientSide] = React.useState(false);
784
785
  const topMenuRef = React.useRef(null);
785
- const shouldShowViewport = [
786
- ...components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links,
787
- ...components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links,
788
- ...components_navigationMenu_globalNavigation_utils.BUSINESS_UKKO_LINKS.links,
789
- ...components_navigationMenu_globalNavigation_utils.MDU_LINKS.links
790
- ].some((link) => {
791
- const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
792
- return link.links.length && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
793
- });
794
786
  const topMenuSize = utils_useSize.useSize(topMenuRef.current);
795
- const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
796
- const [isClientSide, setIsClientSide] = React.useState(false);
797
787
  React.useEffect(() => {
798
788
  setIsClientSide(true);
799
789
  }, []);
800
790
  if (!rootContext) return null;
791
+ const links = components_navigationMenu_globalNavigation_utils.getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale"), rootContext.customLinks);
792
+ const shouldShowViewport = links.flatMap((link) => link.links || []).some((link) => {
793
+ var _a;
794
+ const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
795
+ return (((_a = link.links) == null ? void 0 : _a.length) || 0) > 0 && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
796
+ });
797
+ const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
801
798
  const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
802
799
  const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
803
800
  const handleInteractions = (linkName) => {
@@ -812,7 +809,7 @@ const Desktop = React.forwardRef(() => {
812
809
  style: utils_generateStyling_index.mergeStyles({ ["--teddy-top-menu-height"]: topMenuHeight }),
813
810
  className: styles[`${rootClassName}__top-menu-wrapper`],
814
811
  children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.TopMenuList, { ref: topMenuRef, children: [
815
- components_navigationMenu_globalNavigation_utils.getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).map((link) => /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
812
+ links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
816
813
  NavigationMenu.TopMenuTrigger,
817
814
  {
818
815
  value: link.name,
@@ -831,117 +828,114 @@ const Desktop = React.forwardRef(() => {
831
828
  ] })
832
829
  }
833
830
  ) }),
834
- components_navigationMenu_globalNavigation_utils.getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).map((link) => {
831
+ links.map((link) => {
835
832
  var _a;
836
833
  return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.List, { value: link.name, children: (_a = link.links) == null ? void 0 : _a.map(
837
- (subLink) => {
838
- var _a2, _b;
839
- return /* @__PURE__ */ jsxRuntime.jsxs(
840
- NavigationMenu.Item,
841
- {
842
- value: subLink.name,
843
- onMouseEnter: () => setShowMenu(true),
844
- onMouseLeave: () => setShowMenu(false),
845
- children: [
846
- subLink.name === "Logo" ? /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(
847
- Link2,
848
- {
849
- href: subLink.link,
850
- onMouseEnter: () => handleInteractions(),
851
- onClick: () => handleInteractions(),
852
- children: /* @__PURE__ */ jsxRuntime.jsx(
853
- "img",
854
- {
855
- src: "https://www.telia.no/globalassets/static/svg/telia-primary-default-v2.svg",
856
- draggable: "false",
857
- alt: "Telia logo"
858
- }
859
- )
860
- }
861
- ) : /* @__PURE__ */ jsxRuntime.jsx(
862
- "a",
863
- {
864
- href: subLink.link,
865
- onMouseEnter: () => handleInteractions(),
866
- onClick: () => handleInteractions(),
867
- children: /* @__PURE__ */ jsxRuntime.jsx(
868
- "img",
869
- {
870
- src: "https://www.telia.no/globalassets/static/svg/telia-primary-default-v2.svg",
871
- draggable: "false",
872
- alt: "Telia logo"
873
- }
874
- )
875
- }
876
- ) }) : /* @__PURE__ */ jsxRuntime.jsx(
877
- NavigationMenu.Link,
878
- {
879
- asChild: true,
880
- active: selectedMenuItem === subLink.name && currentLocation === subLink.link,
881
- onFocus: () => {
882
- handleInteractions(subLink.name);
883
- setShowMenu(true);
884
- },
885
- children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(
886
- Link2,
834
+ (subLink) => /* @__PURE__ */ jsxRuntime.jsxs(
835
+ NavigationMenu.Item,
836
+ {
837
+ value: subLink.name,
838
+ onMouseEnter: () => setShowMenu(true),
839
+ onMouseLeave: () => setShowMenu(false),
840
+ children: [
841
+ subLink.name === "Logo" ? /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(
842
+ Link2,
843
+ {
844
+ href: subLink.link,
845
+ onMouseEnter: () => handleInteractions(),
846
+ onClick: () => handleInteractions(),
847
+ children: /* @__PURE__ */ jsxRuntime.jsx(
848
+ "img",
849
+ {
850
+ src: "https://www.telia.no/globalassets/static/svg/telia-primary-default-v2.svg",
851
+ draggable: "false",
852
+ alt: "Telia logo"
853
+ }
854
+ )
855
+ }
856
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
857
+ "a",
858
+ {
859
+ href: subLink.link,
860
+ onMouseEnter: () => handleInteractions(),
861
+ onClick: () => handleInteractions(),
862
+ children: /* @__PURE__ */ jsxRuntime.jsx(
863
+ "img",
864
+ {
865
+ src: "https://www.telia.no/globalassets/static/svg/telia-primary-default-v2.svg",
866
+ draggable: "false",
867
+ alt: "Telia logo"
868
+ }
869
+ )
870
+ }
871
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx(
872
+ NavigationMenu.Link,
873
+ {
874
+ asChild: true,
875
+ active: selectedMenuItem === subLink.name && currentLocation === subLink.link,
876
+ onFocus: () => {
877
+ handleInteractions(subLink.name);
878
+ setShowMenu(true);
879
+ },
880
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(
881
+ Link2,
882
+ {
883
+ onMouseEnter: () => handleInteractions(subLink.name),
884
+ onClick: () => {
885
+ handleInteractions(subLink.name);
886
+ setShowMenu(false);
887
+ },
888
+ href: subLink.link,
889
+ children: subLink.name
890
+ }
891
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
892
+ "a",
893
+ {
894
+ onMouseEnter: () => handleInteractions(subLink.name),
895
+ onClick: () => {
896
+ handleInteractions(subLink.name);
897
+ setShowMenu(false);
898
+ },
899
+ onFocus: () => {
900
+ setShowMenu(true);
901
+ },
902
+ href: subLink.link,
903
+ children: subLink.name
904
+ }
905
+ )
906
+ }
907
+ ),
908
+ /* @__PURE__ */ jsxRuntime.jsx(
909
+ "div",
910
+ {
911
+ style: utils_generateStyling_index.mergeStyles({ ["--teddy-viewport-wrapper-height"]: viewPortHeight }),
912
+ className: styles[`${rootClassName}__viewport-wrapper`],
913
+ "data-state": showMenu ? "open" : "closed",
914
+ children: isClientSide && /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
915
+ subLink.links && subLink.links.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
916
+ HightlightedLinksDesktop,
887
917
  {
888
- onMouseEnter: () => handleInteractions(subLink.name),
889
- onClick: () => {
890
- handleInteractions(subLink.name);
891
- setShowMenu(false);
892
- },
893
- href: subLink.link,
894
- children: subLink.name
918
+ listName: subLink.name,
919
+ setShowMenu,
920
+ links: subLink.links
895
921
  }
896
- ) : /* @__PURE__ */ jsxRuntime.jsx(
897
- "a",
922
+ ),
923
+ subLink.highlightedLinks && subLink.highlightedLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
924
+ HightlightedLinksDesktop,
898
925
  {
899
- onMouseEnter: () => handleInteractions(subLink.name),
900
- onClick: () => {
901
- handleInteractions(subLink.name);
902
- setShowMenu(false);
903
- },
904
- onFocus: () => {
905
- setShowMenu(true);
906
- },
907
- href: subLink.link,
908
- children: subLink.name
926
+ colored: true,
927
+ listName: "Nyttige snarveier",
928
+ setShowMenu,
929
+ links: subLink.highlightedLinks
909
930
  }
910
931
  )
911
- }
912
- ),
913
- /* @__PURE__ */ jsxRuntime.jsx(
914
- "div",
915
- {
916
- style: utils_generateStyling_index.mergeStyles({ ["--teddy-viewport-wrapper-height"]: viewPortHeight }),
917
- className: styles[`${rootClassName}__viewport-wrapper`],
918
- "data-state": showMenu ? "open" : "closed",
919
- children: isClientSide && /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
920
- ((_a2 = subLink.links) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
921
- HightlightedLinksDesktop,
922
- {
923
- listName: subLink.name,
924
- setShowMenu,
925
- links: subLink.links
926
- }
927
- ),
928
- ((_b = subLink.highlightedLinks) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
929
- HightlightedLinksDesktop,
930
- {
931
- colored: true,
932
- listName: "Nyttige snarveier",
933
- setShowMenu,
934
- links: subLink.highlightedLinks
935
- }
936
- )
937
- ] }) })
938
- }
939
- )
940
- ]
941
- },
942
- subLink.name
943
- );
944
- }
932
+ ] }) })
933
+ }
934
+ )
935
+ ]
936
+ },
937
+ subLink.name
938
+ )
945
939
  ) }, link.name);
946
940
  })
947
941
  ] });
@@ -1011,6 +1005,7 @@ function Mobile(props) {
1011
1005
  const rootContext = React.useContext(RootContext);
1012
1006
  const drawerRef = React.useRef(null);
1013
1007
  if (!rootContext) return null;
1008
+ const links = components_navigationMenu_globalNavigation_utils.getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale"), rootContext.customLinks);
1014
1009
  const { linkComponent: NavLink } = rootContext;
1015
1010
  const classes = clsx([styles[`${rootClassName}__mobile`]], props.className);
1016
1011
  const linkClasses = clsx([styles[`${rootClassName}__link`]]);
@@ -1044,12 +1039,12 @@ function Mobile(props) {
1044
1039
  value: rootContext.selectedDomainItem,
1045
1040
  onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
1046
1041
  children: [
1047
- /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: components_navigationMenu_globalNavigation_utils.getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
1048
- /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: components_navigationMenu_globalNavigation_utils.getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).map((link) => {
1042
+ /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
1043
+ /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: links.map((link) => {
1049
1044
  var _a, _b;
1050
1045
  return /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: link.name, children: [
1051
1046
  /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", children: (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
1052
- (subLink) => subLink.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { onClick: () => setSpecifiedLink(subLink.name), className: linkClasses, children: [
1047
+ (subLink) => subLink.links && subLink.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { onClick: () => setSpecifiedLink(subLink.name), className: linkClasses, children: [
1053
1048
  /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { asChild: true, variant: "title-300", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { className: styles[`${rootClassName}__sublink-button--mobile`], children: subLink.name }) }),
1054
1049
  /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "chevron-right", size: "md" })
1055
1050
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsxs(NavLink, { href: subLink.link, className: linkClasses, children: [
@@ -1060,7 +1055,7 @@ function Mobile(props) {
1060
1055
  /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "chevron-right", size: "md" })
1061
1056
  ] }) })
1062
1057
  ) }),
1063
- ((_b = link.highlightedLinks) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsxRuntime.jsx(
1058
+ link.highlightedLinks && ((_b = link.highlightedLinks) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsxRuntime.jsx(
1064
1059
  HighlightedLinks,
1065
1060
  {
1066
1061
  item: link,
@@ -1079,33 +1074,30 @@ function Mobile(props) {
1079
1074
  /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-left" }),
1080
1075
  "Tilbake"
1081
1076
  ] }) }),
1082
- /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "100", children: components_navigationMenu_globalNavigation_utils.getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).filter((item) => item.name === rootContext.selectedDomainItem).map(
1077
+ /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "100", children: links.filter((item) => item.name === rootContext.selectedDomainItem).map(
1083
1078
  (link) => {
1084
1079
  var _a;
1085
1080
  return (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
1086
- (subLink) => {
1087
- var _a2;
1088
- return subLink.links.length > 0 && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1089
- /* @__PURE__ */ jsxRuntime.jsx(
1090
- HighlightedLinks,
1091
- {
1092
- item: subLink,
1093
- listTitle: subLink.name,
1094
- links: subLink.links,
1095
- drawerRef
1096
- }
1097
- ),
1098
- ((_a2 = subLink.highlightedLinks) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsxRuntime.jsx(
1099
- HighlightedLinks,
1100
- {
1101
- item: subLink,
1102
- listTitle: "Nyttige snarveier",
1103
- links: subLink.highlightedLinks,
1104
- drawerRef
1105
- }
1106
- ) }) })
1107
- ] });
1108
- }
1081
+ (subLink) => subLink.links && subLink.links.length > 0 && subLink.name === specifiedLink && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1082
+ /* @__PURE__ */ jsxRuntime.jsx(
1083
+ HighlightedLinks,
1084
+ {
1085
+ item: subLink,
1086
+ listTitle: subLink.name,
1087
+ links: subLink.links,
1088
+ drawerRef
1089
+ }
1090
+ ),
1091
+ subLink.highlightedLinks && subLink.highlightedLinks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsxRuntime.jsx(
1092
+ HighlightedLinks,
1093
+ {
1094
+ item: subLink,
1095
+ listTitle: "Nyttige snarveier",
1096
+ links: subLink.highlightedLinks,
1097
+ drawerRef
1098
+ }
1099
+ ) }) })
1100
+ ] })
1109
1101
  );
1110
1102
  }
1111
1103
  ) })
@@ -1157,8 +1149,9 @@ const DesktopSimplified = React.forwardRef(() => {
1157
1149
  if (!rootContext) return null;
1158
1150
  const { setSelectedMenuItem, linkComponent: Link2 } = rootContext;
1159
1151
  const isBusinessRental = rootContext.pathname.includes("bedrift/utstyrsavtale");
1152
+ const links = components_navigationMenu_globalNavigation_utils.getLinks(isBusinessRental, rootContext.customLinks);
1160
1153
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1161
- components_navigationMenu_globalNavigation_utils.getLinks(isBusinessRental).map((link) => {
1154
+ links.map((link) => {
1162
1155
  var _a;
1163
1156
  return /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.List, { value: link.name, children: [
1164
1157
  (_a = link.links) == null ? void 0 : _a.map((subLink) => /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.Item, { value: subLink.name, children: [
@@ -1214,6 +1207,7 @@ function Root({
1214
1207
  onCartOpenChange,
1215
1208
  drawerSize = "md",
1216
1209
  isSimplified,
1210
+ customLinks,
1217
1211
  currentPath,
1218
1212
  onSearchInputChange,
1219
1213
  onSearchKeyDown,
@@ -1221,10 +1215,10 @@ function Root({
1221
1215
  onClear,
1222
1216
  ...props
1223
1217
  }) {
1224
- const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
1225
- const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath));
1218
+ const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath, customLinks));
1219
+ const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath, customLinks));
1226
1220
  const [pathname, setPathname] = React.useState(currentPath || "");
1227
- const [specifiedLink, setSpecifiedLink] = React.useState(getInitialMenuItem(currentPath));
1221
+ const [specifiedLink, setSpecifiedLink] = React.useState(getInitialMenuItem(currentPath, customLinks));
1228
1222
  const classes = clsx([styles[`${rootClassName}`]], className);
1229
1223
  React.useEffect(() => {
1230
1224
  setPathname(currentPath || "");
@@ -1264,7 +1258,8 @@ function Root({
1264
1258
  onSearchInputChange,
1265
1259
  onSearchKeyDown,
1266
1260
  searchValue,
1267
- onClear
1261
+ onClear,
1262
+ customLinks
1268
1263
  },
1269
1264
  children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
1270
1265
  NavigationMenu,
@@ -1292,33 +1287,39 @@ function Root({
1292
1287
  );
1293
1288
  }
1294
1289
  Root.displayName = "Root";
1295
- function getInitialDomain(currentPath) {
1296
- if (!currentPath) return components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
1290
+ function getInitialDomain(currentPath, customLinks) {
1291
+ const privateLinks = (customLinks == null ? void 0 : customLinks.privateLinks) || components_navigationMenu_globalNavigation_utils.DEFAULT_PRIVATE_LINKS;
1292
+ const businessLinks = (customLinks == null ? void 0 : customLinks.businessLinks) || components_navigationMenu_globalNavigation_utils.DEFAULT_BUSINESS_LINKS;
1293
+ const mduLinks = (customLinks == null ? void 0 : customLinks.mduLinks) || components_navigationMenu_globalNavigation_utils.DEFAULT_MDU_LINKS;
1294
+ if (!currentPath) return privateLinks.name;
1297
1295
  const locationArray = currentPath ? currentPath.split("/") : [];
1298
1296
  const domainPartOfLocation = `/${locationArray[1].toLowerCase()}/`;
1299
- 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;
1297
+ const initDomain = domainPartOfLocation === businessLinks.link ? businessLinks.name : domainPartOfLocation === mduLinks.link ? mduLinks.name : privateLinks.name;
1300
1298
  return initDomain;
1301
1299
  }
1302
- function getInitialMenuItem(currentPath) {
1300
+ function getInitialMenuItem(currentPath, customLinks) {
1303
1301
  var _a, _b, _c, _d, _e, _f;
1302
+ const privateLinks = (customLinks == null ? void 0 : customLinks.privateLinks) || components_navigationMenu_globalNavigation_utils.DEFAULT_PRIVATE_LINKS;
1303
+ const businessLinks = (customLinks == null ? void 0 : customLinks.businessLinks) || components_navigationMenu_globalNavigation_utils.DEFAULT_BUSINESS_LINKS;
1304
+ const mduLinks = (customLinks == null ? void 0 : customLinks.mduLinks) || components_navigationMenu_globalNavigation_utils.DEFAULT_MDU_LINKS;
1304
1305
  if (!currentPath) return;
1305
1306
  const locationArray = currentPath ? currentPath.split("/") : [];
1306
- const initialDomain = getInitialDomain(currentPath);
1307
- if (initialDomain === "Bedrift") {
1307
+ const initialDomain = getInitialDomain(currentPath, customLinks);
1308
+ if (initialDomain === businessLinks.name) {
1308
1309
  const mainMenuPartOfLocation2 = locationArray[2];
1309
- return (_b = (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links) == null ? void 0 : _a.find(
1310
+ return (_b = (_a = businessLinks.links) == null ? void 0 : _a.find(
1310
1311
  (link) => {
1311
1312
  var _a2;
1312
1313
  return link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`));
1313
1314
  }
1314
1315
  )) == null ? void 0 : _b.name;
1315
1316
  }
1316
- if (initialDomain === "Borettslag") {
1317
+ if (initialDomain === mduLinks.name) {
1317
1318
  const mainMenuPartOfLocation2 = locationArray[2];
1318
- return (_d = (_c = components_navigationMenu_globalNavigation_utils.MDU_LINKS.links) == null ? void 0 : _c.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _d.name;
1319
+ return (_d = (_c = mduLinks.links) == null ? void 0 : _c.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _d.name;
1319
1320
  }
1320
1321
  const mainMenuPartOfLocation = locationArray[1];
1321
- return (_f = (_e = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links) == null ? void 0 : _e.find((link) => {
1322
+ return (_f = (_e = privateLinks.links) == null ? void 0 : _e.find((link) => {
1322
1323
  var _a2;
1323
1324
  return link.name.toLowerCase() === mainMenuPartOfLocation || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
1324
1325
  })) == null ? void 0 : _f.name;