@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.
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import React__default, { useEffect } from "react";
3
3
  import clsx from "clsx";
4
- import { MY_PAGE_RETAILER_LINKS, MY_PAGE_LINKS, LOGGED_IN_LINKS_BUSINESS, PRIVATE_LINKS, BUSINESS_LINKS, BUSINESS_UKKO_LINKS, MDU_LINKS, getLinks, getActiveSubLink } from "../navigation-menu/global-navigation/utils.js";
4
+ import { MY_PAGE_RETAILER_LINKS, MY_PAGE_LINKS, LOGGED_IN_LINKS_BUSINESS, getLinks, getActiveSubLink, DEFAULT_PRIVATE_LINKS, DEFAULT_BUSINESS_LINKS, DEFAULT_MDU_LINKS } from "../navigation-menu/global-navigation/utils.js";
5
5
  import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
6
6
  import { useComposedRefs } from "../../utils/composeRefs.js";
7
7
  import { VisuallyHidden } from "../visually-hidden/visually-hidden.js";
@@ -760,23 +760,20 @@ ShoppingCart.displayName = "ShoppingCart";
760
760
  const Desktop = React__default.forwardRef(() => {
761
761
  const rootContext = React__default.useContext(RootContext);
762
762
  const [showMenu, setShowMenu] = React__default.useState(false);
763
+ const [isClientSide, setIsClientSide] = React__default.useState(false);
763
764
  const topMenuRef = React__default.useRef(null);
764
- const shouldShowViewport = [
765
- ...PRIVATE_LINKS.links,
766
- ...BUSINESS_LINKS.links,
767
- ...BUSINESS_UKKO_LINKS.links,
768
- ...MDU_LINKS.links
769
- ].some((link) => {
770
- const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
771
- return link.links.length && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
772
- });
773
765
  const topMenuSize = useSize(topMenuRef.current);
774
- const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
775
- const [isClientSide, setIsClientSide] = React__default.useState(false);
776
766
  React__default.useEffect(() => {
777
767
  setIsClientSide(true);
778
768
  }, []);
779
769
  if (!rootContext) return null;
770
+ const links = getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale"), rootContext.customLinks);
771
+ const shouldShowViewport = links.flatMap((link) => link.links || []).some((link) => {
772
+ var _a;
773
+ const sameParent = link.link.split("/")[1] === (rootContext == null ? void 0 : rootContext.pathname.split("/")[1]) || !link.link && (rootContext == null ? void 0 : rootContext.pathname) === "/";
774
+ return (((_a = link.links) == null ? void 0 : _a.length) || 0) > 0 && link.name === (rootContext == null ? void 0 : rootContext.specifiedLink) && sameParent;
775
+ });
776
+ const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
780
777
  const { selectedMenuItem, setSelectedMenuItem, linkComponent: Link2, specifiedLink, setSpecifiedLink } = rootContext;
781
778
  const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
782
779
  const handleInteractions = (linkName) => {
@@ -791,7 +788,7 @@ const Desktop = React__default.forwardRef(() => {
791
788
  style: mergeStyles({ ["--teddy-top-menu-height"]: topMenuHeight }),
792
789
  className: styles[`${rootClassName}__top-menu-wrapper`],
793
790
  children: /* @__PURE__ */ jsxs(NavigationMenu.TopMenuList, { ref: topMenuRef, children: [
794
- getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).map((link) => /* @__PURE__ */ jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsx(
791
+ links.map((link) => /* @__PURE__ */ jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsx(
795
792
  NavigationMenu.TopMenuTrigger,
796
793
  {
797
794
  value: link.name,
@@ -810,117 +807,114 @@ const Desktop = React__default.forwardRef(() => {
810
807
  ] })
811
808
  }
812
809
  ) }),
813
- getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).map((link) => {
810
+ links.map((link) => {
814
811
  var _a;
815
812
  return /* @__PURE__ */ jsx(NavigationMenu.List, { value: link.name, children: (_a = link.links) == null ? void 0 : _a.map(
816
- (subLink) => {
817
- var _a2, _b;
818
- return /* @__PURE__ */ jsxs(
819
- NavigationMenu.Item,
820
- {
821
- value: subLink.name,
822
- onMouseEnter: () => setShowMenu(true),
823
- onMouseLeave: () => setShowMenu(false),
824
- children: [
825
- subLink.name === "Logo" ? /* @__PURE__ */ jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(
826
- Link2,
827
- {
828
- href: subLink.link,
829
- onMouseEnter: () => handleInteractions(),
830
- onClick: () => handleInteractions(),
831
- children: /* @__PURE__ */ jsx(
832
- "img",
833
- {
834
- src: "https://www.telia.no/globalassets/static/svg/telia-primary-default-v2.svg",
835
- draggable: "false",
836
- alt: "Telia logo"
837
- }
838
- )
839
- }
840
- ) : /* @__PURE__ */ jsx(
841
- "a",
842
- {
843
- href: subLink.link,
844
- onMouseEnter: () => handleInteractions(),
845
- onClick: () => handleInteractions(),
846
- children: /* @__PURE__ */ jsx(
847
- "img",
848
- {
849
- src: "https://www.telia.no/globalassets/static/svg/telia-primary-default-v2.svg",
850
- draggable: "false",
851
- alt: "Telia logo"
852
- }
853
- )
854
- }
855
- ) }) : /* @__PURE__ */ jsx(
856
- NavigationMenu.Link,
857
- {
858
- asChild: true,
859
- active: selectedMenuItem === subLink.name && currentLocation === subLink.link,
860
- onFocus: () => {
861
- handleInteractions(subLink.name);
862
- setShowMenu(true);
863
- },
864
- children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(
865
- Link2,
813
+ (subLink) => /* @__PURE__ */ jsxs(
814
+ NavigationMenu.Item,
815
+ {
816
+ value: subLink.name,
817
+ onMouseEnter: () => setShowMenu(true),
818
+ onMouseLeave: () => setShowMenu(false),
819
+ children: [
820
+ subLink.name === "Logo" ? /* @__PURE__ */ jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(
821
+ Link2,
822
+ {
823
+ href: subLink.link,
824
+ onMouseEnter: () => handleInteractions(),
825
+ onClick: () => handleInteractions(),
826
+ children: /* @__PURE__ */ jsx(
827
+ "img",
828
+ {
829
+ src: "https://www.telia.no/globalassets/static/svg/telia-primary-default-v2.svg",
830
+ draggable: "false",
831
+ alt: "Telia logo"
832
+ }
833
+ )
834
+ }
835
+ ) : /* @__PURE__ */ jsx(
836
+ "a",
837
+ {
838
+ href: subLink.link,
839
+ onMouseEnter: () => handleInteractions(),
840
+ onClick: () => handleInteractions(),
841
+ children: /* @__PURE__ */ jsx(
842
+ "img",
843
+ {
844
+ src: "https://www.telia.no/globalassets/static/svg/telia-primary-default-v2.svg",
845
+ draggable: "false",
846
+ alt: "Telia logo"
847
+ }
848
+ )
849
+ }
850
+ ) }) : /* @__PURE__ */ jsx(
851
+ NavigationMenu.Link,
852
+ {
853
+ asChild: true,
854
+ active: selectedMenuItem === subLink.name && currentLocation === subLink.link,
855
+ onFocus: () => {
856
+ handleInteractions(subLink.name);
857
+ setShowMenu(true);
858
+ },
859
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(
860
+ Link2,
861
+ {
862
+ onMouseEnter: () => handleInteractions(subLink.name),
863
+ onClick: () => {
864
+ handleInteractions(subLink.name);
865
+ setShowMenu(false);
866
+ },
867
+ href: subLink.link,
868
+ children: subLink.name
869
+ }
870
+ ) : /* @__PURE__ */ jsx(
871
+ "a",
872
+ {
873
+ onMouseEnter: () => handleInteractions(subLink.name),
874
+ onClick: () => {
875
+ handleInteractions(subLink.name);
876
+ setShowMenu(false);
877
+ },
878
+ onFocus: () => {
879
+ setShowMenu(true);
880
+ },
881
+ href: subLink.link,
882
+ children: subLink.name
883
+ }
884
+ )
885
+ }
886
+ ),
887
+ /* @__PURE__ */ jsx(
888
+ "div",
889
+ {
890
+ style: mergeStyles({ ["--teddy-viewport-wrapper-height"]: viewPortHeight }),
891
+ className: styles[`${rootClassName}__viewport-wrapper`],
892
+ "data-state": showMenu ? "open" : "closed",
893
+ children: isClientSide && /* @__PURE__ */ jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
894
+ subLink.links && subLink.links.length > 0 && /* @__PURE__ */ jsx(
895
+ HightlightedLinksDesktop,
866
896
  {
867
- onMouseEnter: () => handleInteractions(subLink.name),
868
- onClick: () => {
869
- handleInteractions(subLink.name);
870
- setShowMenu(false);
871
- },
872
- href: subLink.link,
873
- children: subLink.name
897
+ listName: subLink.name,
898
+ setShowMenu,
899
+ links: subLink.links
874
900
  }
875
- ) : /* @__PURE__ */ jsx(
876
- "a",
901
+ ),
902
+ subLink.highlightedLinks && subLink.highlightedLinks.length > 0 && /* @__PURE__ */ jsx(
903
+ HightlightedLinksDesktop,
877
904
  {
878
- onMouseEnter: () => handleInteractions(subLink.name),
879
- onClick: () => {
880
- handleInteractions(subLink.name);
881
- setShowMenu(false);
882
- },
883
- onFocus: () => {
884
- setShowMenu(true);
885
- },
886
- href: subLink.link,
887
- children: subLink.name
905
+ colored: true,
906
+ listName: "Nyttige snarveier",
907
+ setShowMenu,
908
+ links: subLink.highlightedLinks
888
909
  }
889
910
  )
890
- }
891
- ),
892
- /* @__PURE__ */ jsx(
893
- "div",
894
- {
895
- style: mergeStyles({ ["--teddy-viewport-wrapper-height"]: viewPortHeight }),
896
- className: styles[`${rootClassName}__viewport-wrapper`],
897
- "data-state": showMenu ? "open" : "closed",
898
- children: isClientSide && /* @__PURE__ */ jsx(NavigationMenu.Content, { children: !!specifiedLink && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
899
- ((_a2 = subLink.links) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsx(
900
- HightlightedLinksDesktop,
901
- {
902
- listName: subLink.name,
903
- setShowMenu,
904
- links: subLink.links
905
- }
906
- ),
907
- ((_b = subLink.highlightedLinks) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsx(
908
- HightlightedLinksDesktop,
909
- {
910
- colored: true,
911
- listName: "Nyttige snarveier",
912
- setShowMenu,
913
- links: subLink.highlightedLinks
914
- }
915
- )
916
- ] }) })
917
- }
918
- )
919
- ]
920
- },
921
- subLink.name
922
- );
923
- }
911
+ ] }) })
912
+ }
913
+ )
914
+ ]
915
+ },
916
+ subLink.name
917
+ )
924
918
  ) }, link.name);
925
919
  })
926
920
  ] });
@@ -990,6 +984,7 @@ function Mobile(props) {
990
984
  const rootContext = React__default.useContext(RootContext);
991
985
  const drawerRef = React__default.useRef(null);
992
986
  if (!rootContext) return null;
987
+ const links = getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale"), rootContext.customLinks);
993
988
  const { linkComponent: NavLink } = rootContext;
994
989
  const classes = clsx([styles[`${rootClassName}__mobile`]], props.className);
995
990
  const linkClasses = clsx([styles[`${rootClassName}__link`]]);
@@ -1023,12 +1018,12 @@ function Mobile(props) {
1023
1018
  value: rootContext.selectedDomainItem,
1024
1019
  onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
1025
1020
  children: [
1026
- /* @__PURE__ */ jsx(Tabs.List, { children: getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).map((link) => /* @__PURE__ */ jsx(Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
1027
- /* @__PURE__ */ jsx(Fragment, { children: getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).map((link) => {
1021
+ /* @__PURE__ */ jsx(Tabs.List, { children: links.map((link) => /* @__PURE__ */ jsx(Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
1022
+ /* @__PURE__ */ jsx(Fragment, { children: links.map((link) => {
1028
1023
  var _a, _b;
1029
1024
  return /* @__PURE__ */ jsxs(Tabs.Content, { value: link.name, children: [
1030
1025
  /* @__PURE__ */ jsx(Box, { mt: "400", children: (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
1031
- (subLink) => subLink.links.length > 0 ? /* @__PURE__ */ jsxs(Box, { onClick: () => setSpecifiedLink(subLink.name), className: linkClasses, children: [
1026
+ (subLink) => subLink.links && subLink.links.length > 0 ? /* @__PURE__ */ jsxs(Box, { onClick: () => setSpecifiedLink(subLink.name), className: linkClasses, children: [
1032
1027
  /* @__PURE__ */ jsx(Heading, { asChild: true, variant: "title-300", children: /* @__PURE__ */ jsx(Button, { className: styles[`${rootClassName}__sublink-button--mobile`], children: subLink.name }) }),
1033
1028
  /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: "md" })
1034
1029
  ] }) : /* @__PURE__ */ jsx(Fragment, { children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxs(NavLink, { href: subLink.link, className: linkClasses, children: [
@@ -1039,7 +1034,7 @@ function Mobile(props) {
1039
1034
  /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: "md" })
1040
1035
  ] }) })
1041
1036
  ) }),
1042
- ((_b = link.highlightedLinks) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsx(Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsx(Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsx(
1037
+ link.highlightedLinks && ((_b = link.highlightedLinks) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsx(Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsx(Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsx(
1043
1038
  HighlightedLinks,
1044
1039
  {
1045
1040
  item: link,
@@ -1058,33 +1053,30 @@ function Mobile(props) {
1058
1053
  /* @__PURE__ */ jsx(Icon, { name: "arrow-left" }),
1059
1054
  "Tilbake"
1060
1055
  ] }) }),
1061
- /* @__PURE__ */ jsx(Box, { mt: "100", children: getLinks(rootContext.pathname.includes("bedrift/utstyrsavtale")).filter((item) => item.name === rootContext.selectedDomainItem).map(
1056
+ /* @__PURE__ */ jsx(Box, { mt: "100", children: links.filter((item) => item.name === rootContext.selectedDomainItem).map(
1062
1057
  (link) => {
1063
1058
  var _a;
1064
1059
  return (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
1065
- (subLink) => {
1066
- var _a2;
1067
- return subLink.links.length > 0 && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
1068
- /* @__PURE__ */ jsx(
1069
- HighlightedLinks,
1070
- {
1071
- item: subLink,
1072
- listTitle: subLink.name,
1073
- links: subLink.links,
1074
- drawerRef
1075
- }
1076
- ),
1077
- ((_a2 = subLink.highlightedLinks) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsx(Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsx(Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsx(
1078
- HighlightedLinks,
1079
- {
1080
- item: subLink,
1081
- listTitle: "Nyttige snarveier",
1082
- links: subLink.highlightedLinks,
1083
- drawerRef
1084
- }
1085
- ) }) })
1086
- ] });
1087
- }
1060
+ (subLink) => subLink.links && subLink.links.length > 0 && subLink.name === specifiedLink && /* @__PURE__ */ jsxs(Fragment, { children: [
1061
+ /* @__PURE__ */ jsx(
1062
+ HighlightedLinks,
1063
+ {
1064
+ item: subLink,
1065
+ listTitle: subLink.name,
1066
+ links: subLink.links,
1067
+ drawerRef
1068
+ }
1069
+ ),
1070
+ subLink.highlightedLinks && subLink.highlightedLinks.length > 0 && /* @__PURE__ */ jsx(Box, { className: styles[`${rootClassName}__colored-box--mobile`], children: /* @__PURE__ */ jsx(Box, { mt: "400", pt: "250", pb: "250", pl: "300", children: /* @__PURE__ */ jsx(
1071
+ HighlightedLinks,
1072
+ {
1073
+ item: subLink,
1074
+ listTitle: "Nyttige snarveier",
1075
+ links: subLink.highlightedLinks,
1076
+ drawerRef
1077
+ }
1078
+ ) }) })
1079
+ ] })
1088
1080
  );
1089
1081
  }
1090
1082
  ) })
@@ -1136,8 +1128,9 @@ const DesktopSimplified = React__default.forwardRef(() => {
1136
1128
  if (!rootContext) return null;
1137
1129
  const { setSelectedMenuItem, linkComponent: Link2 } = rootContext;
1138
1130
  const isBusinessRental = rootContext.pathname.includes("bedrift/utstyrsavtale");
1131
+ const links = getLinks(isBusinessRental, rootContext.customLinks);
1139
1132
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1140
- getLinks(isBusinessRental).map((link) => {
1133
+ links.map((link) => {
1141
1134
  var _a;
1142
1135
  return /* @__PURE__ */ jsxs(NavigationMenu.List, { value: link.name, children: [
1143
1136
  (_a = link.links) == null ? void 0 : _a.map((subLink) => /* @__PURE__ */ jsxs(NavigationMenu.Item, { value: subLink.name, children: [
@@ -1193,6 +1186,7 @@ function Root({
1193
1186
  onCartOpenChange,
1194
1187
  drawerSize = "md",
1195
1188
  isSimplified,
1189
+ customLinks,
1196
1190
  currentPath,
1197
1191
  onSearchInputChange,
1198
1192
  onSearchKeyDown,
@@ -1200,10 +1194,10 @@ function Root({
1200
1194
  onClear,
1201
1195
  ...props
1202
1196
  }) {
1203
- const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(getInitialMenuItem(currentPath));
1204
- const [selectedDomainItem, setSelectedDomainItem] = React__default.useState(getInitialDomain(currentPath));
1197
+ const [selectedMenuItem, setSelectedMenuItem] = React__default.useState(getInitialMenuItem(currentPath, customLinks));
1198
+ const [selectedDomainItem, setSelectedDomainItem] = React__default.useState(getInitialDomain(currentPath, customLinks));
1205
1199
  const [pathname, setPathname] = React__default.useState(currentPath || "");
1206
- const [specifiedLink, setSpecifiedLink] = React__default.useState(getInitialMenuItem(currentPath));
1200
+ const [specifiedLink, setSpecifiedLink] = React__default.useState(getInitialMenuItem(currentPath, customLinks));
1207
1201
  const classes = clsx([styles[`${rootClassName}`]], className);
1208
1202
  useEffect(() => {
1209
1203
  setPathname(currentPath || "");
@@ -1243,7 +1237,8 @@ function Root({
1243
1237
  onSearchInputChange,
1244
1238
  onSearchKeyDown,
1245
1239
  searchValue,
1246
- onClear
1240
+ onClear,
1241
+ customLinks
1247
1242
  },
1248
1243
  children: /* @__PURE__ */ jsx(Box, { ...props, className: classes, children: /* @__PURE__ */ jsxs(
1249
1244
  NavigationMenu,
@@ -1271,33 +1266,39 @@ function Root({
1271
1266
  );
1272
1267
  }
1273
1268
  Root.displayName = "Root";
1274
- function getInitialDomain(currentPath) {
1275
- if (!currentPath) return PRIVATE_LINKS.name;
1269
+ function getInitialDomain(currentPath, customLinks) {
1270
+ const privateLinks = (customLinks == null ? void 0 : customLinks.privateLinks) || DEFAULT_PRIVATE_LINKS;
1271
+ const businessLinks = (customLinks == null ? void 0 : customLinks.businessLinks) || DEFAULT_BUSINESS_LINKS;
1272
+ const mduLinks = (customLinks == null ? void 0 : customLinks.mduLinks) || DEFAULT_MDU_LINKS;
1273
+ if (!currentPath) return privateLinks.name;
1276
1274
  const locationArray = currentPath ? currentPath.split("/") : [];
1277
1275
  const domainPartOfLocation = `/${locationArray[1].toLowerCase()}/`;
1278
- const initDomain = domainPartOfLocation === BUSINESS_LINKS.link ? BUSINESS_LINKS.name : domainPartOfLocation === MDU_LINKS.link ? MDU_LINKS.name : PRIVATE_LINKS.name;
1276
+ const initDomain = domainPartOfLocation === businessLinks.link ? businessLinks.name : domainPartOfLocation === mduLinks.link ? mduLinks.name : privateLinks.name;
1279
1277
  return initDomain;
1280
1278
  }
1281
- function getInitialMenuItem(currentPath) {
1279
+ function getInitialMenuItem(currentPath, customLinks) {
1282
1280
  var _a, _b, _c, _d, _e, _f;
1281
+ const privateLinks = (customLinks == null ? void 0 : customLinks.privateLinks) || DEFAULT_PRIVATE_LINKS;
1282
+ const businessLinks = (customLinks == null ? void 0 : customLinks.businessLinks) || DEFAULT_BUSINESS_LINKS;
1283
+ const mduLinks = (customLinks == null ? void 0 : customLinks.mduLinks) || DEFAULT_MDU_LINKS;
1283
1284
  if (!currentPath) return;
1284
1285
  const locationArray = currentPath ? currentPath.split("/") : [];
1285
- const initialDomain = getInitialDomain(currentPath);
1286
- if (initialDomain === "Bedrift") {
1286
+ const initialDomain = getInitialDomain(currentPath, customLinks);
1287
+ if (initialDomain === businessLinks.name) {
1287
1288
  const mainMenuPartOfLocation2 = locationArray[2];
1288
- return (_b = (_a = BUSINESS_LINKS.links) == null ? void 0 : _a.find(
1289
+ return (_b = (_a = businessLinks.links) == null ? void 0 : _a.find(
1289
1290
  (link) => {
1290
1291
  var _a2;
1291
1292
  return link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`));
1292
1293
  }
1293
1294
  )) == null ? void 0 : _b.name;
1294
1295
  }
1295
- if (initialDomain === "Borettslag") {
1296
+ if (initialDomain === mduLinks.name) {
1296
1297
  const mainMenuPartOfLocation2 = locationArray[2];
1297
- return (_d = (_c = MDU_LINKS.links) == null ? void 0 : _c.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _d.name;
1298
+ return (_d = (_c = mduLinks.links) == null ? void 0 : _c.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _d.name;
1298
1299
  }
1299
1300
  const mainMenuPartOfLocation = locationArray[1];
1300
- return (_f = (_e = PRIVATE_LINKS.links) == null ? void 0 : _e.find((link) => {
1301
+ return (_f = (_e = privateLinks.links) == null ? void 0 : _e.find((link) => {
1301
1302
  var _a2;
1302
1303
  return link.name.toLowerCase() === mainMenuPartOfLocation || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
1303
1304
  })) == null ? void 0 : _f.name;
@@ -21,7 +21,7 @@ export declare const ScrollArea: import('react').ForwardRefExoticComponent<Omit<
21
21
  loading?: boolean | undefined;
22
22
  fullWidth?: boolean | undefined;
23
23
  size?: "sm" | "md" | "lg" | undefined;
24
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
24
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
25
25
  borderStyle?: ("dashed" | "default") | undefined;
26
26
  } & {
27
27
  iconOnly: true;
@@ -33,7 +33,7 @@ export declare const ScrollArea: import('react').ForwardRefExoticComponent<Omit<
33
33
  loading?: boolean | undefined;
34
34
  fullWidth?: boolean | undefined;
35
35
  size?: "sm" | "md" | "lg" | undefined;
36
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
36
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
37
37
  borderStyle?: ("dashed" | "default") | undefined;
38
38
  } & {
39
39
  iconOnly?: false | undefined;
@@ -17,7 +17,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<Reac
17
17
  loading?: boolean | undefined;
18
18
  fullWidth?: boolean | undefined;
19
19
  size?: "sm" | "md" | "lg" | undefined;
20
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
20
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
21
21
  borderStyle?: ("dashed" | "default") | undefined;
22
22
  } & {
23
23
  iconOnly: true;
@@ -29,7 +29,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<Reac
29
29
  loading?: boolean | undefined;
30
30
  fullWidth?: boolean | undefined;
31
31
  size?: "sm" | "md" | "lg" | undefined;
32
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
32
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
33
33
  borderStyle?: ("dashed" | "default") | undefined;
34
34
  } & {
35
35
  iconOnly?: false | undefined;
@@ -10,7 +10,7 @@ export declare const ScrollButton: React.ForwardRefExoticComponent<Omit<Omit<Omi
10
10
  loading?: boolean | undefined;
11
11
  fullWidth?: boolean | undefined;
12
12
  size?: "sm" | "md" | "lg" | undefined;
13
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
13
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
14
14
  borderStyle?: ("dashed" | "default") | undefined;
15
15
  } & {
16
16
  iconOnly: true;
@@ -22,7 +22,7 @@ export declare const ScrollButton: React.ForwardRefExoticComponent<Omit<Omit<Omi
22
22
  loading?: boolean | undefined;
23
23
  fullWidth?: boolean | undefined;
24
24
  size?: "sm" | "md" | "lg" | undefined;
25
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
25
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
26
26
  borderStyle?: ("dashed" | "default") | undefined;
27
27
  } & {
28
28
  iconOnly?: false | undefined;
@@ -35,7 +35,7 @@ export declare const TextField: import('react').ForwardRefExoticComponent<Omit<i
35
35
  loading?: boolean | undefined;
36
36
  fullWidth?: boolean | undefined;
37
37
  size?: "sm" | "md" | "lg" | undefined;
38
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
38
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
39
39
  borderStyle?: ("dashed" | "default") | undefined;
40
40
  } & {
41
41
  iconOnly: true;
@@ -47,7 +47,7 @@ export declare const TextField: import('react').ForwardRefExoticComponent<Omit<i
47
47
  loading?: boolean | undefined;
48
48
  fullWidth?: boolean | undefined;
49
49
  size?: "sm" | "md" | "lg" | undefined;
50
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
50
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
51
51
  borderStyle?: ("dashed" | "default") | undefined;
52
52
  } & {
53
53
  iconOnly?: false | undefined;
@@ -11,7 +11,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<Reac
11
11
  loading?: boolean | undefined;
12
12
  fullWidth?: boolean | undefined;
13
13
  size?: "sm" | "md" | "lg" | undefined;
14
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
14
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
15
15
  borderStyle?: ("dashed" | "default") | undefined;
16
16
  } & {
17
17
  iconOnly: true;
@@ -23,7 +23,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<Reac
23
23
  loading?: boolean | undefined;
24
24
  fullWidth?: boolean | undefined;
25
25
  size?: "sm" | "md" | "lg" | undefined;
26
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
26
+ variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "text-underline" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
27
27
  borderStyle?: ("dashed" | "default") | undefined;
28
28
  } & {
29
29
  iconOnly?: false | undefined;