@telia/teddy 0.7.14 → 0.7.16

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,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { AppKey } from './utils';
2
+ import { AppKey, CustomLinksConfig } from './utils';
3
3
 
4
4
  export declare const rootClassName = "teddy-global-navigation";
5
5
  type User = {
@@ -19,6 +19,7 @@ export type RootProps = React.ComponentPropsWithoutRef<'div'> & {
19
19
  onCartOpenChange?: (open: boolean) => void;
20
20
  drawerSize: 'md' | 'lg';
21
21
  isSimplified?: boolean;
22
+ customLinks?: CustomLinksConfig;
22
23
  currentPath: string | undefined;
23
24
  onSearchInputChange?: (e: React.ChangeEvent<HTMLInputElement>, value?: string) => void;
24
25
  onSearchKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
@@ -34,9 +35,10 @@ type RootContext = {
34
35
  setPathname: (v: string) => void;
35
36
  specifiedLink?: string;
36
37
  setSpecifiedLink: (v: string) => void;
38
+ customLinks?: CustomLinksConfig;
37
39
  } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize' | 'onSearchInputChange' | 'onSearchKeyDown' | 'searchValue' | 'onClear'>;
38
40
  export declare const RootContext: React.Context<RootContext | null>;
39
- export declare function Root({ className, appKey, loggedInUser, linkComponent, onLogoutClick, shoppingCart, shoppingCartNumberOfItems, onSearchSubmit, additionalSearchContent, isCartOpen, onCartOpenChange, drawerSize, isSimplified, currentPath, onSearchInputChange, onSearchKeyDown, searchValue, onClear, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function Root({ className, appKey, loggedInUser, linkComponent, onLogoutClick, shoppingCart, shoppingCartNumberOfItems, onSearchSubmit, additionalSearchContent, isCartOpen, onCartOpenChange, drawerSize, isSimplified, customLinks, currentPath, onSearchInputChange, onSearchKeyDown, searchValue, onClear, ...props }: RootProps): import("react/jsx-runtime").JSX.Element;
40
42
  export declare namespace Root {
41
43
  var displayName: string;
42
44
  }
@@ -48,7 +48,7 @@ const MY_PAGE_RETAILER_LINKS = {
48
48
  links: [
49
49
  {
50
50
  name: "Velg Butikk",
51
- link: "/forhandler/butikk",
51
+ link: "/forhandler/butikker",
52
52
  appKey: APP_KEYS["web-shop"],
53
53
  icon: "store"
54
54
  },
@@ -66,7 +66,7 @@ const MY_PAGE_RETAILER_LINKS = {
66
66
  },
67
67
  {
68
68
  name: "Se kundeopplysninger",
69
- link: "/forhandler/kunde",
69
+ link: "/forhandler/dashboard/kunde",
70
70
  appKey: APP_KEYS["web-shop"],
71
71
  icon: "end-user"
72
72
  }
@@ -1097,7 +1097,16 @@ const MDU_LINKS = {
1097
1097
  }
1098
1098
  ]
1099
1099
  };
1100
- const getLinks = (ukko = false) => [PRIVATE_LINKS, ukko ? BUSINESS_UKKO_LINKS : BUSINESS_LINKS, MDU_LINKS];
1100
+ const DEFAULT_PRIVATE_LINKS = PRIVATE_LINKS;
1101
+ const DEFAULT_BUSINESS_LINKS = BUSINESS_LINKS;
1102
+ const DEFAULT_BUSINESS_UKKO_LINKS = BUSINESS_UKKO_LINKS;
1103
+ const DEFAULT_MDU_LINKS = MDU_LINKS;
1104
+ const getLinks = (ukko = false, customLinks) => {
1105
+ const privateLinks = (customLinks == null ? void 0 : customLinks.privateLinks) || DEFAULT_PRIVATE_LINKS;
1106
+ const businessLinks = ukko ? (customLinks == null ? void 0 : customLinks.businessUkkoLinks) || DEFAULT_BUSINESS_UKKO_LINKS : (customLinks == null ? void 0 : customLinks.businessLinks) || DEFAULT_BUSINESS_LINKS;
1107
+ const mduLinks = (customLinks == null ? void 0 : customLinks.mduLinks) || DEFAULT_MDU_LINKS;
1108
+ return [privateLinks, businessLinks, mduLinks];
1109
+ };
1101
1110
  const getActiveSubLink = (path, links) => {
1102
1111
  let activeLink = "";
1103
1112
  links.forEach((link) => {
@@ -1111,6 +1120,10 @@ exports.APP_KEYS = APP_KEYS;
1111
1120
  exports.BUSINESS_LINKS = BUSINESS_LINKS;
1112
1121
  exports.BUSINESS_NET_LINKS = BUSINESS_NET_LINKS;
1113
1122
  exports.BUSINESS_UKKO_LINKS = BUSINESS_UKKO_LINKS;
1123
+ exports.DEFAULT_BUSINESS_LINKS = DEFAULT_BUSINESS_LINKS;
1124
+ exports.DEFAULT_BUSINESS_UKKO_LINKS = DEFAULT_BUSINESS_UKKO_LINKS;
1125
+ exports.DEFAULT_MDU_LINKS = DEFAULT_MDU_LINKS;
1126
+ exports.DEFAULT_PRIVATE_LINKS = DEFAULT_PRIVATE_LINKS;
1114
1127
  exports.LOGGED_IN_LINKS = LOGGED_IN_LINKS;
1115
1128
  exports.LOGGED_IN_LINKS_BUSINESS = LOGGED_IN_LINKS_BUSINESS;
1116
1129
  exports.MDU_LINKS = MDU_LINKS;