@telia/teddy 0.6.16 → 0.6.17

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.
@@ -4,6 +4,7 @@ import { AppKey } from './utils';
4
4
  export declare const rootClassName = "teddy-global-navigation";
5
5
  type User = {
6
6
  name: string;
7
+ isRetailer?: boolean;
7
8
  };
8
9
  export type RootProps = React.ComponentPropsWithoutRef<'div'> & {
9
10
  appKey: AppKey;
@@ -33,7 +34,7 @@ type RootContext = {
33
34
  setPathname: (v: string) => void;
34
35
  specifiedLink?: string;
35
36
  setSpecifiedLink: (v: string) => void;
36
- } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize' | "onSearchInputChange" | 'onSearchKeyDown' | 'searchValue' | 'onClear'>;
37
+ } & Pick<RootProps, 'onSearchSubmit' | 'additionalSearchContent' | 'shoppingCart' | 'shoppingCartNumberOfItems' | 'loggedInUser' | 'appKey' | 'onLogoutClick' | 'linkComponent' | 'isCartOpen' | 'onCartOpenChange' | 'drawerSize' | 'onSearchInputChange' | 'onSearchKeyDown' | 'searchValue' | 'onClear'>;
37
38
  export declare const RootContext: React.Context<RootContext | null>;
38
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;
39
40
  export declare namespace Root {
@@ -41,6 +41,37 @@ const MY_PAGE_LINKS = {
41
41
  }
42
42
  ]
43
43
  };
44
+ const MY_PAGE_RETAILER_LINKS = {
45
+ name: "Min Side",
46
+ link: "/forhandler",
47
+ appKey: APP_KEYS["web-shop"],
48
+ links: [
49
+ {
50
+ name: "Velg Butikk",
51
+ link: "/forhandler/butikk",
52
+ appKey: APP_KEYS["web-shop"],
53
+ icon: "store"
54
+ },
55
+ {
56
+ name: "Mine Ordre",
57
+ link: "/forhandler/mine-ordre",
58
+ appKey: APP_KEYS["web-shop"],
59
+ icon: "report"
60
+ },
61
+ {
62
+ name: "Administrasjon",
63
+ link: "/forhandler/administrasjon",
64
+ appKey: APP_KEYS["web-shop"],
65
+ icon: "settings"
66
+ },
67
+ {
68
+ name: "Se kundeopplysninger",
69
+ link: "/forhandler/kunde",
70
+ appKey: APP_KEYS["web-shop"],
71
+ icon: "end-user"
72
+ }
73
+ ]
74
+ };
44
75
  const MY_BUSINESS_LINKS = {
45
76
  name: "Min bedrift",
46
77
  link: "https://beta.minbedrift.telia.no",
@@ -1085,6 +1116,7 @@ exports.LOGGED_IN_LINKS_BUSINESS = LOGGED_IN_LINKS_BUSINESS;
1085
1116
  exports.MDU_LINKS = MDU_LINKS;
1086
1117
  exports.MY_BUSINESS_LINKS = MY_BUSINESS_LINKS;
1087
1118
  exports.MY_PAGE_LINKS = MY_PAGE_LINKS;
1119
+ exports.MY_PAGE_RETAILER_LINKS = MY_PAGE_RETAILER_LINKS;
1088
1120
  exports.MY_PORTAL_LINKS = MY_PORTAL_LINKS;
1089
1121
  exports.PRIVATE_LINKS = PRIVATE_LINKS;
1090
1122
  exports.SMART_CONNECT_LINKS = SMART_CONNECT_LINKS;
@@ -45,6 +45,32 @@ export declare const MY_PAGE_LINKS: {
45
45
  readonly icon: "secured-1";
46
46
  }];
47
47
  };
48
+ export declare const MY_PAGE_RETAILER_LINKS: {
49
+ readonly name: "Min Side";
50
+ readonly link: "/forhandler";
51
+ readonly appKey: "web-shop";
52
+ readonly links: [{
53
+ readonly name: "Velg Butikk";
54
+ readonly link: "/forhandler/butikk";
55
+ readonly appKey: "web-shop";
56
+ readonly icon: "store";
57
+ }, {
58
+ readonly name: "Mine Ordre";
59
+ readonly link: "/forhandler/mine-ordre";
60
+ readonly appKey: "web-shop";
61
+ readonly icon: "report";
62
+ }, {
63
+ readonly name: "Administrasjon";
64
+ readonly link: "/forhandler/administrasjon";
65
+ readonly appKey: "web-shop";
66
+ readonly icon: "settings";
67
+ }, {
68
+ readonly name: "Se kundeopplysninger";
69
+ readonly link: "/forhandler/kunde";
70
+ readonly appKey: "web-shop";
71
+ readonly icon: "end-user";
72
+ }];
73
+ };
48
74
  export declare const MY_BUSINESS_LINKS: {
49
75
  readonly name: "Min bedrift";
50
76
  readonly link: "https://beta.minbedrift.telia.no";
@@ -39,6 +39,37 @@ const MY_PAGE_LINKS = {
39
39
  }
40
40
  ]
41
41
  };
42
+ const MY_PAGE_RETAILER_LINKS = {
43
+ name: "Min Side",
44
+ link: "/forhandler",
45
+ appKey: APP_KEYS["web-shop"],
46
+ links: [
47
+ {
48
+ name: "Velg Butikk",
49
+ link: "/forhandler/butikk",
50
+ appKey: APP_KEYS["web-shop"],
51
+ icon: "store"
52
+ },
53
+ {
54
+ name: "Mine Ordre",
55
+ link: "/forhandler/mine-ordre",
56
+ appKey: APP_KEYS["web-shop"],
57
+ icon: "report"
58
+ },
59
+ {
60
+ name: "Administrasjon",
61
+ link: "/forhandler/administrasjon",
62
+ appKey: APP_KEYS["web-shop"],
63
+ icon: "settings"
64
+ },
65
+ {
66
+ name: "Se kundeopplysninger",
67
+ link: "/forhandler/kunde",
68
+ appKey: APP_KEYS["web-shop"],
69
+ icon: "end-user"
70
+ }
71
+ ]
72
+ };
42
73
  const MY_BUSINESS_LINKS = {
43
74
  name: "Min bedrift",
44
75
  link: "https://beta.minbedrift.telia.no",
@@ -1084,6 +1115,7 @@ export {
1084
1115
  MDU_LINKS,
1085
1116
  MY_BUSINESS_LINKS,
1086
1117
  MY_PAGE_LINKS,
1118
+ MY_PAGE_RETAILER_LINKS,
1087
1119
  MY_PORTAL_LINKS,
1088
1120
  PRIVATE_LINKS,
1089
1121
  SMART_CONNECT_LINKS,
@@ -643,8 +643,16 @@ function LoggedOutContent() {
643
643
  ] });
644
644
  }
645
645
  function LoggedInContent() {
646
- var _a;
646
+ var _a, _b, _c;
647
647
  const rootContext = React.useContext(RootContext);
648
+ const isRetailerLoggedIn = (_a = rootContext == null ? void 0 : rootContext.loggedInUser) == null ? void 0 : _a.isRetailer;
649
+ if (isRetailerLoggedIn) {
650
+ return /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
651
+ /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Min Side" }),
652
+ (_b = components_navigationMenu_globalNavigation_utils.MY_PAGE_RETAILER_LINKS.links) == null ? void 0 : _b.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link)),
653
+ /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { mt: "200", onClick: () => rootContext == null ? void 0 : rootContext.onLogoutClick(), variant: "secondary", children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "logout", children: "Logg ut" }) })
654
+ ] });
655
+ }
648
656
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
649
657
  /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Mine sider" }),
650
658
  /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs, { defaultValue: "private", children: [
@@ -655,7 +663,7 @@ function LoggedInContent() {
655
663
  /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
656
664
  /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "private", children: [
657
665
  /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Min Side" }),
658
- (_a = components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.links) == null ? void 0 : _a.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link))
666
+ (_c = components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.links) == null ? void 0 : _c.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link))
659
667
  ] }),
660
668
  /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "business", children: [
661
669
  /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedriftsportaler" }),
@@ -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_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_LINKS, LOGGED_IN_LINKS_BUSINESS, MY_PAGE_RETAILER_LINKS, PRIVATE_LINKS, BUSINESS_LINKS, BUSINESS_UKKO_LINKS, MDU_LINKS, getLinks, getActiveSubLink } 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";
@@ -622,8 +622,16 @@ function LoggedOutContent() {
622
622
  ] });
623
623
  }
624
624
  function LoggedInContent() {
625
- var _a;
625
+ var _a, _b, _c;
626
626
  const rootContext = React__default.useContext(RootContext);
627
+ const isRetailerLoggedIn = (_a = rootContext == null ? void 0 : rootContext.loggedInUser) == null ? void 0 : _a.isRetailer;
628
+ if (isRetailerLoggedIn) {
629
+ return /* @__PURE__ */ jsxs(TextSpacing, { children: [
630
+ /* @__PURE__ */ jsx(Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Min Side" }),
631
+ (_b = MY_PAGE_RETAILER_LINKS.links) == null ? void 0 : _b.map((link) => /* @__PURE__ */ jsx(Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsx("a", { href: link.link, children: /* @__PURE__ */ jsx(Icon, { name: link.icon, children: link.name }) }) }, link.link)),
632
+ /* @__PURE__ */ jsx(Button, { mt: "200", onClick: () => rootContext == null ? void 0 : rootContext.onLogoutClick(), variant: "secondary", children: /* @__PURE__ */ jsx(Icon, { name: "logout", children: "Logg ut" }) })
633
+ ] });
634
+ }
627
635
  return /* @__PURE__ */ jsxs(Fragment, { children: [
628
636
  /* @__PURE__ */ jsx(Drawer.Title, { children: "Mine sider" }),
629
637
  /* @__PURE__ */ jsxs(Tabs, { defaultValue: "private", children: [
@@ -634,7 +642,7 @@ function LoggedInContent() {
634
642
  /* @__PURE__ */ jsxs(TextSpacing, { children: [
635
643
  /* @__PURE__ */ jsxs(Tabs.Content, { value: "private", children: [
636
644
  /* @__PURE__ */ jsx(Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Min Side" }),
637
- (_a = MY_PAGE_LINKS.links) == null ? void 0 : _a.map((link) => /* @__PURE__ */ jsx(Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsx("a", { href: link.link, children: /* @__PURE__ */ jsx(Icon, { name: link.icon, children: link.name }) }) }, link.link))
645
+ (_c = MY_PAGE_LINKS.links) == null ? void 0 : _c.map((link) => /* @__PURE__ */ jsx(Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsx("a", { href: link.link, children: /* @__PURE__ */ jsx(Icon, { name: link.icon, children: link.name }) }) }, link.link))
638
646
  ] }),
639
647
  /* @__PURE__ */ jsxs(Tabs.Content, { value: "business", children: [
640
648
  /* @__PURE__ */ jsx(Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedriftsportaler" }),
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.6.16",
23
+ "version": "0.6.17",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"