@lokalise/harmony 1.40.3-exp-epic2x.7 → 1.40.3-exp-epic2x.8

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.
Files changed (65) hide show
  1. package/dist/harmony108.cjs +2 -2
  2. package/dist/harmony108.mjs +2 -2
  3. package/dist/harmony109.cjs +2 -2
  4. package/dist/harmony109.mjs +2 -2
  5. package/dist/harmony110.cjs +2 -2
  6. package/dist/harmony110.mjs +2 -2
  7. package/dist/harmony112.cjs +2 -2
  8. package/dist/harmony112.mjs +2 -2
  9. package/dist/harmony113.cjs +2 -2
  10. package/dist/harmony113.mjs +2 -2
  11. package/dist/harmony114.cjs +1 -1
  12. package/dist/harmony114.mjs +1 -1
  13. package/dist/harmony115.cjs +2 -2
  14. package/dist/harmony115.mjs +2 -2
  15. package/dist/harmony116.cjs +1 -1
  16. package/dist/harmony116.mjs +1 -1
  17. package/dist/harmony117.cjs +2 -2
  18. package/dist/harmony117.mjs +2 -2
  19. package/dist/harmony77.cjs +2 -2
  20. package/dist/harmony77.mjs +2 -2
  21. package/dist/harmony84.cjs +1 -1
  22. package/dist/harmony84.mjs +1 -1
  23. package/dist/harmony85.cjs +7 -7
  24. package/dist/harmony85.mjs +7 -7
  25. package/dist/harmony90.cjs +11 -3
  26. package/dist/harmony90.cjs.map +1 -1
  27. package/dist/harmony90.mjs +11 -3
  28. package/dist/harmony90.mjs.map +1 -1
  29. package/dist/harmony91.cjs +21 -18
  30. package/dist/harmony91.cjs.map +1 -1
  31. package/dist/harmony91.mjs +20 -17
  32. package/dist/harmony91.mjs.map +1 -1
  33. package/dist/harmony92.cjs +3 -76
  34. package/dist/harmony92.cjs.map +1 -1
  35. package/dist/harmony92.mjs +3 -76
  36. package/dist/harmony92.mjs.map +1 -1
  37. package/dist/harmony93.cjs +17 -11
  38. package/dist/harmony93.cjs.map +1 -1
  39. package/dist/harmony93.mjs +17 -11
  40. package/dist/harmony93.mjs.map +1 -1
  41. package/dist/harmony94.cjs +76 -30
  42. package/dist/harmony94.cjs.map +1 -1
  43. package/dist/harmony94.mjs +76 -30
  44. package/dist/harmony94.mjs.map +1 -1
  45. package/dist/harmony95.cjs +12 -9
  46. package/dist/harmony95.cjs.map +1 -1
  47. package/dist/harmony95.mjs +12 -9
  48. package/dist/harmony95.mjs.map +1 -1
  49. package/dist/harmony96.cjs +30 -47
  50. package/dist/harmony96.cjs.map +1 -1
  51. package/dist/harmony96.mjs +30 -47
  52. package/dist/harmony96.mjs.map +1 -1
  53. package/dist/harmony97.cjs +10 -10
  54. package/dist/harmony97.cjs.map +1 -1
  55. package/dist/harmony97.mjs +9 -9
  56. package/dist/harmony97.mjs.map +1 -1
  57. package/dist/harmony98.cjs +45 -9
  58. package/dist/harmony98.cjs.map +1 -1
  59. package/dist/harmony98.mjs +47 -11
  60. package/dist/harmony98.mjs.map +1 -1
  61. package/dist/harmony99.cjs +8 -20
  62. package/dist/harmony99.cjs.map +1 -1
  63. package/dist/harmony99.mjs +8 -20
  64. package/dist/harmony99.mjs.map +1 -1
  65. package/package.json +1 -1
@@ -1,79 +1,6 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { BillingMenuItem } from "./harmony108.mjs";
3
- import { CreateNewTeam } from "./harmony109.mjs";
4
- import { CreateNewTeamPlaceholder } from "./harmony110.mjs";
5
- import { DarkModeToggle } from "./harmony111.mjs";
6
- import { ProfileSettingsMenuItem } from "./harmony112.mjs";
7
- import { ProviderMenuItem } from "./harmony113.mjs";
8
- import { TeamMenuItem } from "./harmony114.mjs";
9
- import { TeamSettingsMenuItem } from "./harmony115.mjs";
10
- import { TeamSwitch } from "./harmony116.mjs";
11
- import { UpgradeMenuItem } from "./harmony117.mjs";
12
- import { useSidebar } from "./harmony93.mjs";
13
- import { Menu, MenuList, MenuDivider, MenuItem, UserIcon } from "@lokalise/louis";
14
- import { canAccessProfileSettings, canUpgradePlan } from "./harmony94.mjs";
15
- import { clsx } from "./harmony73.mjs";
16
- import styles from "./harmony118.mjs";
17
- import { UpgradeIcon } from "./harmony119.mjs";
18
- const ProfileMenu = ({ config }) => {
19
- const {
20
- jwt,
21
- data: { currentTeam }
22
- } = useSidebar();
23
- const {
24
- darkModeToggle,
25
- teamSwitch,
26
- createTeam,
27
- createTeamPlaceholder,
28
- upgradeMenuItem,
29
- profileSettings
30
- } = config;
31
- return /* @__PURE__ */ jsx(
32
- Menu,
33
- {
34
- menuButton: () => {
35
- var _a;
36
- return /* @__PURE__ */ jsxs("button", { className: styles.profileButton, "aria-label": "Profile menu", type: "button", children: [
37
- ((_a = currentTeam.result) == null ? void 0 : _a.logoUrl) ? /* @__PURE__ */ jsx(
38
- "img",
39
- {
40
- src: currentTeam.result.logoUrl,
41
- className: clsx(styles.profileImage, {
42
- [styles.profileImageHighlight]: canUpgradePlan(jwt)
43
- }),
44
- alt: "Team Logo"
45
- }
46
- ) : /* @__PURE__ */ jsx(
47
- "div",
48
- {
49
- className: clsx(styles.userIconWrapper, "flex-row", "align-center", "items-center", {
50
- [styles.profileImageHighlight]: canUpgradePlan(jwt)
51
- }),
52
- children: /* @__PURE__ */ jsx(UserIcon, { size: "25px" })
53
- }
54
- ),
55
- canUpgradePlan(jwt) && /* @__PURE__ */ jsx(UpgradeIcon, { className: styles.profileImageUpgradeIcon })
56
- ] });
57
- },
58
- children: /* @__PURE__ */ jsxs(MenuList, { placement: "right-end", className: styles.menuContainer, children: [
59
- teamSwitch && /* @__PURE__ */ jsx(TeamSwitch, { onSwitchTeam: teamSwitch.onSwitchTeam }),
60
- createTeam && /* @__PURE__ */ jsx(CreateNewTeam, { onCreateTeam: createTeam.onCreateTeam }),
61
- createTeamPlaceholder && /* @__PURE__ */ jsx(CreateNewTeamPlaceholder, { onClick: createTeamPlaceholder.onClick }),
62
- /* @__PURE__ */ jsx(TeamMenuItem, {}),
63
- upgradeMenuItem && /* @__PURE__ */ jsx(UpgradeMenuItem, { href: upgradeMenuItem.href }),
64
- /* @__PURE__ */ jsx(BillingMenuItem, {}),
65
- /* @__PURE__ */ jsx(TeamSettingsMenuItem, {}),
66
- /* @__PURE__ */ jsx(ProviderMenuItem, {}),
67
- /* @__PURE__ */ jsx(MenuDivider, {}),
68
- profileSettings && /* @__PURE__ */ jsx(ProfileSettingsMenuItem, {}),
69
- darkModeToggle && /* @__PURE__ */ jsx(DarkModeToggle, { ...darkModeToggle }),
70
- (profileSettings && canAccessProfileSettings(jwt) || darkModeToggle) && /* @__PURE__ */ jsx(MenuDivider, {}),
71
- /* @__PURE__ */ jsx(MenuItem, { href: "/login?action=logout", children: "Logout" })
72
- ] })
73
- }
74
- );
75
- };
1
+ import { createContext } from "react";
2
+ const SidebarContext = createContext({});
76
3
  export {
77
- ProfileMenu
4
+ SidebarContext
78
5
  };
79
6
  //# sourceMappingURL=harmony92.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony92.mjs","sources":["../src/components/Sidebar/Widgets/ProfileMenu/ProfileMenu.tsx"],"sourcesContent":["import { BillingMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/BillingMenuItem/BillingMenuItem'\nimport { CreateNewTeam } from '@components/Sidebar/Widgets/ProfileMenu/CreateNewTeam/CreateNewTeam'\nimport { CreateNewTeamPlaceholder } from '@components/Sidebar/Widgets/ProfileMenu/CreateNewTeamPlaceholder/CreateNewTeamPlaceholder'\nimport { DarkModeToggle } from '@components/Sidebar/Widgets/ProfileMenu/DarkModeToggle/DarkModeToggle'\nimport { ProfileSettingsMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/ProfileSettingsMenuItem/ProfileSettingsMenuItem'\nimport { ProviderMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/ProviderMenuItem/ProviderMenuItem'\nimport { TeamMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/TeamMenuItem/TeamMenuItem'\nimport { TeamSettingsMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/TeamSettingsMenuItem/TeamSettingsMenuItem'\nimport { TeamSwitch } from '@components/Sidebar/Widgets/ProfileMenu/TeamSwitch/TeamSwitch'\nimport { UpgradeMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/UpgradeMenuItem/UpgradeMenuItem'\nimport { useSidebar } from '@components/Sidebar/hooks/useSidebar'\nimport type { ProfileMenuConfig } from '@components/Sidebar/types'\nimport { Menu, MenuDivider, MenuItem, MenuList, UserIcon } from '@lokalise/louis'\nimport { canAccessProfileSettings, canUpgradePlan } from '@utils/user/permissions'\nimport clsx from 'clsx'\nimport styles from './ProfileMenu.module.css'\nimport { UpgradeIcon } from './UpgradeIcon/UpgradeIcon'\n\n/**\n * The main profile menu component, displaying team and user actions.\n * Renders optional menu items based on the provided config and user permissions.\n *\n * @example\n * ```\n * <ProfileMenu config={...} />\n * ```\n *\n * @note This component must be used within a Sidebar Context.\n */\n\ntype ProfileMenuProps = {\n\tconfig: ProfileMenuConfig\n}\n\nexport const ProfileMenu = ({ config }: ProfileMenuProps) => {\n\tconst {\n\t\tjwt,\n\t\tdata: { currentTeam },\n\t} = useSidebar()\n\n\tconst {\n\t\tdarkModeToggle,\n\t\tteamSwitch,\n\t\tcreateTeam,\n\t\tcreateTeamPlaceholder,\n\t\tupgradeMenuItem,\n\t\tprofileSettings,\n\t} = config\n\n\treturn (\n\t\t<Menu\n\t\t\tmenuButton={() => (\n\t\t\t\t<button className={styles.profileButton} aria-label=\"Profile menu\" type=\"button\">\n\t\t\t\t\t{currentTeam.result?.logoUrl ? (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={currentTeam.result.logoUrl}\n\t\t\t\t\t\t\tclassName={clsx(styles.profileImage, {\n\t\t\t\t\t\t\t\t[styles.profileImageHighlight]: canUpgradePlan(jwt),\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\talt=\"Team Logo\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={clsx(styles.userIconWrapper, 'flex-row', 'align-center', 'items-center', {\n\t\t\t\t\t\t\t\t[styles.profileImageHighlight]: canUpgradePlan(jwt),\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<UserIcon size=\"25px\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t{canUpgradePlan(jwt) && <UpgradeIcon className={styles.profileImageUpgradeIcon} />}\n\t\t\t\t</button>\n\t\t\t)}\n\t\t>\n\t\t\t<MenuList placement=\"right-end\" className={styles.menuContainer}>\n\t\t\t\t{teamSwitch && <TeamSwitch onSwitchTeam={teamSwitch.onSwitchTeam} />}\n\t\t\t\t{createTeam && <CreateNewTeam onCreateTeam={createTeam.onCreateTeam} />}\n\t\t\t\t{createTeamPlaceholder && (\n\t\t\t\t\t<CreateNewTeamPlaceholder onClick={createTeamPlaceholder.onClick} />\n\t\t\t\t)}\n\t\t\t\t<TeamMenuItem />\n\t\t\t\t{upgradeMenuItem && <UpgradeMenuItem href={upgradeMenuItem.href} />}\n\t\t\t\t<BillingMenuItem />\n\t\t\t\t<TeamSettingsMenuItem />\n\t\t\t\t<ProviderMenuItem />\n\t\t\t\t<MenuDivider />\n\n\t\t\t\t{profileSettings && <ProfileSettingsMenuItem />}\n\t\t\t\t{darkModeToggle && <DarkModeToggle {...darkModeToggle} />}\n\t\t\t\t{((profileSettings && canAccessProfileSettings(jwt)) || darkModeToggle) && <MenuDivider />}\n\n\t\t\t\t<MenuItem href=\"/login?action=logout\">Logout</MenuItem>\n\t\t\t</MenuList>\n\t\t</Menu>\n\t)\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkCO,MAAM,cAAc,CAAC,EAAE,aAA+B;AACtD,QAAA;AAAA,IACL;AAAA,IACA,MAAM,EAAE,YAAY;AAAA,MACjB,WAAW;AAET,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAGH,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,YAAY,MACX;;AAAA,oCAAC,UAAO,EAAA,WAAW,OAAO,eAAe,cAAW,gBAAe,MAAK,UACtE,UAAA;AAAA,YAAA,iBAAY,WAAZ,mBAAoB,WACpB;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,KAAK,YAAY,OAAO;AAAA,cACxB,WAAW,KAAK,OAAO,cAAc;AAAA,gBACpC,CAAC,OAAO,qBAAqB,GAAG,eAAe,GAAG;AAAA,cAAA,CAClD;AAAA,cACD,KAAI;AAAA,YAAA;AAAA,UAAA,IAGL;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,WAAW,KAAK,OAAO,iBAAiB,YAAY,gBAAgB,gBAAgB;AAAA,gBACnF,CAAC,OAAO,qBAAqB,GAAG,eAAe,GAAG;AAAA,cAAA,CAClD;AAAA,cAED,UAAA,oBAAC,UAAS,EAAA,MAAK,OAAO,CAAA;AAAA,YAAA;AAAA,UACvB;AAAA,UAEA,eAAe,GAAG,yBAAM,aAAY,EAAA,WAAW,OAAO,wBAAyB,CAAA;AAAA,QAAA,GACjF;AAAA;AAAA,MAGD,+BAAC,UAAS,EAAA,WAAU,aAAY,WAAW,OAAO,eAChD,UAAA;AAAA,QAAA,cAAe,oBAAA,YAAA,EAAW,cAAc,WAAW,cAAc;AAAA,QACjE,cAAc,oBAAC,eAAc,EAAA,cAAc,WAAW,cAAc;AAAA,QACpE,yBACA,oBAAC,0BAAyB,EAAA,SAAS,sBAAsB,SAAS;AAAA,4BAElE,cAAa,EAAA;AAAA,QACb,mBAAmB,oBAAC,iBAAgB,EAAA,MAAM,gBAAgB,MAAM;AAAA,4BAChE,iBAAgB,EAAA;AAAA,4BAChB,sBAAqB,EAAA;AAAA,4BACrB,kBAAiB,EAAA;AAAA,4BACjB,aAAY,EAAA;AAAA,QAEZ,uCAAoB,yBAAwB,EAAA;AAAA,QAC5C,kBAAkB,oBAAC,gBAAgB,EAAA,GAAG,eAAgB,CAAA;AAAA,SACpD,mBAAmB,yBAAyB,GAAG,KAAM,uCAAoB,aAAY,EAAA;AAAA,QAEvF,oBAAA,UAAA,EAAS,MAAK,wBAAuB,UAAM,SAAA,CAAA;AAAA,MAAA,EAC7C,CAAA;AAAA,IAAA;AAAA,EACD;AAEF;"}
1
+ {"version":3,"file":"harmony92.mjs","sources":["../src/components/Sidebar/SidebarContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { SidebarContextProps } from './types'\n\nexport const SidebarContext = createContext({} as SidebarContextProps)\n\nexport const useSidebar = () => {\n\tconst context = useContext(SidebarContext)\n\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t'You are using useSidebar hook outside its context. Please review your code implementation',\n\t\t)\n\t}\n\n\treturn context\n}\n"],"names":[],"mappings":";AAGa,MAAA,iBAAiB,cAAc,CAAyB,CAAA;"}
@@ -1,15 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SidebarContext = require("./harmony90.cjs");
4
- const React = require("react");
5
- const useSidebar = () => {
6
- const context = React.useContext(SidebarContext.SidebarContext);
7
- if (!context) {
8
- throw new Error(
9
- "You are using useSidebar hook outside its context. Please review your code implementation"
10
- );
11
- }
12
- return context;
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const louis = require("@lokalise/louis");
5
+ const clsx = require("./harmony73.cjs");
6
+ const IconLink_module = require("./harmony107.cjs");
7
+ const IconLink = ({ label, to, icon: Icon }) => {
8
+ return /* @__PURE__ */ jsxRuntime.jsx(louis.Tooltip, { placement: "right", tooltip: label, children: /* @__PURE__ */ jsxRuntime.jsx(
9
+ louis.Link,
10
+ {
11
+ "aria-label": label,
12
+ className: clsx.clsx(IconLink_module.default.link, {
13
+ [IconLink_module.default.active]: typeof window !== "undefined" && window.location.pathname.startsWith(to)
14
+ }),
15
+ href: to,
16
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "25px" })
17
+ }
18
+ ) });
13
19
  };
14
- exports.useSidebar = useSidebar;
20
+ exports.IconLink = IconLink;
15
21
  //# sourceMappingURL=harmony93.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony93.cjs","sources":["../src/components/Sidebar/hooks/useSidebar.ts"],"sourcesContent":["import { SidebarContext } from '@components/Sidebar/SidebarContext'\nimport { useContext } from 'react'\n\nexport const useSidebar = () => {\n\tconst context = useContext(SidebarContext)\n\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t'You are using useSidebar hook outside its context. Please review your code implementation',\n\t\t)\n\t}\n\n\treturn context\n}\n"],"names":["useContext","SidebarContext"],"mappings":";;;;AAGO,MAAM,aAAa,MAAM;AACzB,QAAA,UAAUA,iBAAWC,6BAAc;AAEzC,MAAI,CAAC,SAAS;AACb,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EAAA;AAGM,SAAA;AACR;;"}
1
+ {"version":3,"file":"harmony93.cjs","sources":["../src/components/Sidebar/Widgets/IconLink/IconLink.tsx"],"sourcesContent":["import { Link, type SvgIconProps, Tooltip } from '@lokalise/louis'\nimport clsx from 'clsx'\nimport type { FC } from 'react'\nimport styles from './IconLink.module.css'\n\ntype IconLinkProps = {\n\t/** URL destination for the link */\n\tto: string\n\t/** Text to display in the tooltip when hovering over the icon */\n\tlabel: string\n\t/** Icon component from @lokalise/louis to display */\n\ticon: FC<SvgIconProps>\n}\n\n/**\n * A navigation link component that displays an icon with a tooltip.\n * When hovered, shows a tooltip with the label text.\n * The link is highlighted when the current URL matches its destination.\n *\n * @example\n * ```tsx\n * <IconLink to=\"/projects\" label=\"Projects\" icon={FolderOpenIcon} />\n * ```\n */\nexport const IconLink = ({ label, to, icon: Icon }: IconLinkProps) => {\n\treturn (\n\t\t<Tooltip placement=\"right\" tooltip={label}>\n\t\t\t<Link\n\t\t\t\taria-label={label}\n\t\t\t\tclassName={clsx(styles.link, {\n\t\t\t\t\t[styles.active]: typeof window !== 'undefined' && window.location.pathname.startsWith(to),\n\t\t\t\t})}\n\t\t\t\thref={to}\n\t\t\t>\n\t\t\t\t<Icon size=\"25px\" />\n\t\t\t</Link>\n\t\t</Tooltip>\n\t)\n}\n"],"names":["jsx","Tooltip","Link","clsx","styles"],"mappings":";;;;;;AAwBO,MAAM,WAAW,CAAC,EAAE,OAAO,IAAI,MAAM,WAA0B;AACrE,SACEA,2BAAA,IAAAC,MAAA,SAAA,EAAQ,WAAU,SAAQ,SAAS,OACnC,UAAAD,2BAAA;AAAA,IAACE,MAAA;AAAA,IAAA;AAAA,MACA,cAAY;AAAA,MACZ,WAAWC,KAAAA,KAAKC,gBAAA,QAAO,MAAM;AAAA,QAC5B,CAACA,gBAAO,QAAA,MAAM,GAAG,OAAO,WAAW,eAAe,OAAO,SAAS,SAAS,WAAW,EAAE;AAAA,MAAA,CACxF;AAAA,MACD,MAAM;AAAA,MAEN,UAAAJ,2BAAAA,IAAC,MAAK,EAAA,MAAK,OAAO,CAAA;AAAA,IAAA;AAAA,EAAA,GAEpB;AAEF;;"}
@@ -1,15 +1,21 @@
1
- import { SidebarContext } from "./harmony90.mjs";
2
- import { useContext } from "react";
3
- const useSidebar = () => {
4
- const context = useContext(SidebarContext);
5
- if (!context) {
6
- throw new Error(
7
- "You are using useSidebar hook outside its context. Please review your code implementation"
8
- );
9
- }
10
- return context;
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Tooltip, Link } from "@lokalise/louis";
3
+ import { clsx } from "./harmony73.mjs";
4
+ import styles from "./harmony107.mjs";
5
+ const IconLink = ({ label, to, icon: Icon }) => {
6
+ return /* @__PURE__ */ jsx(Tooltip, { placement: "right", tooltip: label, children: /* @__PURE__ */ jsx(
7
+ Link,
8
+ {
9
+ "aria-label": label,
10
+ className: clsx(styles.link, {
11
+ [styles.active]: typeof window !== "undefined" && window.location.pathname.startsWith(to)
12
+ }),
13
+ href: to,
14
+ children: /* @__PURE__ */ jsx(Icon, { size: "25px" })
15
+ }
16
+ ) });
11
17
  };
12
18
  export {
13
- useSidebar
19
+ IconLink
14
20
  };
15
21
  //# sourceMappingURL=harmony93.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony93.mjs","sources":["../src/components/Sidebar/hooks/useSidebar.ts"],"sourcesContent":["import { SidebarContext } from '@components/Sidebar/SidebarContext'\nimport { useContext } from 'react'\n\nexport const useSidebar = () => {\n\tconst context = useContext(SidebarContext)\n\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t'You are using useSidebar hook outside its context. Please review your code implementation',\n\t\t)\n\t}\n\n\treturn context\n}\n"],"names":[],"mappings":";;AAGO,MAAM,aAAa,MAAM;AACzB,QAAA,UAAU,WAAW,cAAc;AAEzC,MAAI,CAAC,SAAS;AACb,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EAAA;AAGM,SAAA;AACR;"}
1
+ {"version":3,"file":"harmony93.mjs","sources":["../src/components/Sidebar/Widgets/IconLink/IconLink.tsx"],"sourcesContent":["import { Link, type SvgIconProps, Tooltip } from '@lokalise/louis'\nimport clsx from 'clsx'\nimport type { FC } from 'react'\nimport styles from './IconLink.module.css'\n\ntype IconLinkProps = {\n\t/** URL destination for the link */\n\tto: string\n\t/** Text to display in the tooltip when hovering over the icon */\n\tlabel: string\n\t/** Icon component from @lokalise/louis to display */\n\ticon: FC<SvgIconProps>\n}\n\n/**\n * A navigation link component that displays an icon with a tooltip.\n * When hovered, shows a tooltip with the label text.\n * The link is highlighted when the current URL matches its destination.\n *\n * @example\n * ```tsx\n * <IconLink to=\"/projects\" label=\"Projects\" icon={FolderOpenIcon} />\n * ```\n */\nexport const IconLink = ({ label, to, icon: Icon }: IconLinkProps) => {\n\treturn (\n\t\t<Tooltip placement=\"right\" tooltip={label}>\n\t\t\t<Link\n\t\t\t\taria-label={label}\n\t\t\t\tclassName={clsx(styles.link, {\n\t\t\t\t\t[styles.active]: typeof window !== 'undefined' && window.location.pathname.startsWith(to),\n\t\t\t\t})}\n\t\t\t\thref={to}\n\t\t\t>\n\t\t\t\t<Icon size=\"25px\" />\n\t\t\t</Link>\n\t\t</Tooltip>\n\t)\n}\n"],"names":[],"mappings":";;;;AAwBO,MAAM,WAAW,CAAC,EAAE,OAAO,IAAI,MAAM,WAA0B;AACrE,SACE,oBAAA,SAAA,EAAQ,WAAU,SAAQ,SAAS,OACnC,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,cAAY;AAAA,MACZ,WAAW,KAAK,OAAO,MAAM;AAAA,QAC5B,CAAC,OAAO,MAAM,GAAG,OAAO,WAAW,eAAe,OAAO,SAAS,SAAS,WAAW,EAAE;AAAA,MAAA,CACxF;AAAA,MACD,MAAM;AAAA,MAEN,UAAA,oBAAC,MAAK,EAAA,MAAK,OAAO,CAAA;AAAA,IAAA;AAAA,EAAA,GAEpB;AAEF;"}
@@ -1,33 +1,79 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const plan = require("./harmony9.cjs");
4
- const withJwtCheck = (checkFn) => (jwtPayload) => !!jwtPayload && checkFn(jwtPayload);
5
- const canAccessReporting = withJwtCheck(
6
- (jwt) => ["admin", "owner"].includes(jwt.userTeamRole)
7
- );
8
- const canAccessTeamSettings = withJwtCheck(
9
- (jwt) => ["admin", "biller", "owner"].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated
10
- );
11
- const canCreateTeam = withJwtCheck(
12
- (jwt) => ["admin", "owner"].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated && !jwt.isEndOfTrialActive
13
- );
14
- const canUpgradePlan = withJwtCheck(
15
- (jwt) => ["admin", "owner", "biller"].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated && (plan.isFreePlan(jwt.planId) || plan.isTrialPlan(jwt.planId))
16
- );
17
- const canChangeBilling = withJwtCheck(
18
- (jwt) => ["admin", "owner", "biller"].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated && !jwt.isTeamSuspended && !jwt.isEndOfTrialActive
19
- );
20
- const canAccessProviderDashboard = withJwtCheck(
21
- (jwt) => jwt.isProviderAlpha && !jwt.isTeamSuspended && jwt.isFullyAuthenticated
22
- );
23
- const canAccessProfileSettings = withJwtCheck(
24
- (jwt) => !jwt.isEndOfTrialActive && !jwt.isTeamSuspended
25
- );
26
- exports.canAccessProfileSettings = canAccessProfileSettings;
27
- exports.canAccessProviderDashboard = canAccessProviderDashboard;
28
- exports.canAccessReporting = canAccessReporting;
29
- exports.canAccessTeamSettings = canAccessTeamSettings;
30
- exports.canChangeBilling = canChangeBilling;
31
- exports.canCreateTeam = canCreateTeam;
32
- exports.canUpgradePlan = canUpgradePlan;
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const BillingMenuItem = require("./harmony108.cjs");
5
+ const CreateNewTeam = require("./harmony109.cjs");
6
+ const CreateNewTeamPlaceholder = require("./harmony110.cjs");
7
+ const DarkModeToggle = require("./harmony111.cjs");
8
+ const ProfileSettingsMenuItem = require("./harmony112.cjs");
9
+ const ProviderMenuItem = require("./harmony113.cjs");
10
+ const TeamMenuItem = require("./harmony114.cjs");
11
+ const TeamSettingsMenuItem = require("./harmony115.cjs");
12
+ const TeamSwitch = require("./harmony116.cjs");
13
+ const UpgradeMenuItem = require("./harmony117.cjs");
14
+ const useSidebar = require("./harmony95.cjs");
15
+ const louis = require("@lokalise/louis");
16
+ const permissions = require("./harmony96.cjs");
17
+ const clsx = require("./harmony73.cjs");
18
+ const ProfileMenu_module = require("./harmony118.cjs");
19
+ const UpgradeIcon = require("./harmony119.cjs");
20
+ const ProfileMenu = ({ config }) => {
21
+ const {
22
+ jwt,
23
+ data: { currentTeam }
24
+ } = useSidebar.useSidebar();
25
+ const {
26
+ darkModeToggle,
27
+ teamSwitch,
28
+ createTeam,
29
+ createTeamPlaceholder,
30
+ upgradeMenuItem,
31
+ profileSettings
32
+ } = config;
33
+ return /* @__PURE__ */ jsxRuntime.jsx(
34
+ louis.Menu,
35
+ {
36
+ menuButton: () => {
37
+ var _a;
38
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { className: ProfileMenu_module.default.profileButton, "aria-label": "Profile menu", type: "button", children: [
39
+ ((_a = currentTeam.result) == null ? void 0 : _a.logoUrl) ? /* @__PURE__ */ jsxRuntime.jsx(
40
+ "img",
41
+ {
42
+ src: currentTeam.result.logoUrl,
43
+ className: clsx.clsx(ProfileMenu_module.default.profileImage, {
44
+ [ProfileMenu_module.default.profileImageHighlight]: permissions.canUpgradePlan(jwt)
45
+ }),
46
+ alt: "Team Logo"
47
+ }
48
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
49
+ "div",
50
+ {
51
+ className: clsx.clsx(ProfileMenu_module.default.userIconWrapper, "flex-row", "align-center", "items-center", {
52
+ [ProfileMenu_module.default.profileImageHighlight]: permissions.canUpgradePlan(jwt)
53
+ }),
54
+ children: /* @__PURE__ */ jsxRuntime.jsx(louis.UserIcon, { size: "25px" })
55
+ }
56
+ ),
57
+ permissions.canUpgradePlan(jwt) && /* @__PURE__ */ jsxRuntime.jsx(UpgradeIcon.UpgradeIcon, { className: ProfileMenu_module.default.profileImageUpgradeIcon })
58
+ ] });
59
+ },
60
+ children: /* @__PURE__ */ jsxRuntime.jsxs(louis.MenuList, { placement: "right-end", className: ProfileMenu_module.default.menuContainer, children: [
61
+ teamSwitch && /* @__PURE__ */ jsxRuntime.jsx(TeamSwitch.TeamSwitch, { onSwitchTeam: teamSwitch.onSwitchTeam }),
62
+ createTeam && /* @__PURE__ */ jsxRuntime.jsx(CreateNewTeam.CreateNewTeam, { onCreateTeam: createTeam.onCreateTeam }),
63
+ createTeamPlaceholder && /* @__PURE__ */ jsxRuntime.jsx(CreateNewTeamPlaceholder.CreateNewTeamPlaceholder, { onClick: createTeamPlaceholder.onClick }),
64
+ /* @__PURE__ */ jsxRuntime.jsx(TeamMenuItem.TeamMenuItem, {}),
65
+ upgradeMenuItem && /* @__PURE__ */ jsxRuntime.jsx(UpgradeMenuItem.UpgradeMenuItem, { href: upgradeMenuItem.href }),
66
+ /* @__PURE__ */ jsxRuntime.jsx(BillingMenuItem.BillingMenuItem, {}),
67
+ /* @__PURE__ */ jsxRuntime.jsx(TeamSettingsMenuItem.TeamSettingsMenuItem, {}),
68
+ /* @__PURE__ */ jsxRuntime.jsx(ProviderMenuItem.ProviderMenuItem, {}),
69
+ /* @__PURE__ */ jsxRuntime.jsx(louis.MenuDivider, {}),
70
+ profileSettings && /* @__PURE__ */ jsxRuntime.jsx(ProfileSettingsMenuItem.ProfileSettingsMenuItem, {}),
71
+ darkModeToggle && /* @__PURE__ */ jsxRuntime.jsx(DarkModeToggle.DarkModeToggle, { ...darkModeToggle }),
72
+ (profileSettings && permissions.canAccessProfileSettings(jwt) || darkModeToggle) && /* @__PURE__ */ jsxRuntime.jsx(louis.MenuDivider, {}),
73
+ /* @__PURE__ */ jsxRuntime.jsx(louis.MenuItem, { href: "/login?action=logout", children: "Logout" })
74
+ ] })
75
+ }
76
+ );
77
+ };
78
+ exports.ProfileMenu = ProfileMenu;
33
79
  //# sourceMappingURL=harmony94.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony94.cjs","sources":["../src/utils/user/permissions.ts"],"sourcesContent":["import type { JwtTokenPayload } from '@features/auth/core/types/jwtTokenPayload'\nimport { isFreePlan, isTrialPlan } from '@utils'\n\ntype JwtCheckFn = (jwt: JwtTokenPayload) => boolean\n\nconst withJwtCheck =\n\t(checkFn: JwtCheckFn) =>\n\t(jwtPayload: JwtTokenPayload | null | undefined): boolean =>\n\t\t!!jwtPayload && checkFn(jwtPayload)\n\nexport const canAccessStyleGuide = withJwtCheck((jwt) =>\n\t['admin', 'biller', 'owner'].includes(jwt.userTeamRole),\n)\n\nexport const canAccessReporting = withJwtCheck((jwt) =>\n\t['admin', 'owner'].includes(jwt.userTeamRole),\n)\n\nexport const canAccessTeamSettings = withJwtCheck(\n\t(jwt) => ['admin', 'biller', 'owner'].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated,\n)\n\nexport const canCreateTeam = withJwtCheck(\n\t(jwt) =>\n\t\t['admin', 'owner'].includes(jwt.userTeamRole) &&\n\t\tjwt.isFullyAuthenticated &&\n\t\t!jwt.isEndOfTrialActive,\n)\n\nexport const canUpgradePlan = withJwtCheck(\n\t(jwt) =>\n\t\t['admin', 'owner', 'biller'].includes(jwt.userTeamRole) &&\n\t\tjwt.isFullyAuthenticated &&\n\t\t(isFreePlan(jwt.planId) || isTrialPlan(jwt.planId)),\n)\n\nexport const canChangeBilling = withJwtCheck(\n\t(jwt) =>\n\t\t['admin', 'owner', 'biller'].includes(jwt.userTeamRole) &&\n\t\tjwt.isFullyAuthenticated &&\n\t\t!jwt.isTeamSuspended &&\n\t\t!jwt.isEndOfTrialActive,\n)\n\nexport const canAccessProviderDashboard = withJwtCheck(\n\t(jwt) => jwt.isProviderAlpha && !jwt.isTeamSuspended && jwt.isFullyAuthenticated,\n)\n\nexport const canAccessProfileSettings = withJwtCheck(\n\t(jwt) => !jwt.isEndOfTrialActive && !jwt.isTeamSuspended,\n)\n"],"names":["isFreePlan","isTrialPlan"],"mappings":";;;AAKA,MAAM,eACL,CAAC,YACD,CAAC,eACA,CAAC,CAAC,cAAc,QAAQ,UAAU;AAM7B,MAAM,qBAAqB;AAAA,EAAa,CAAC,QAC/C,CAAC,SAAS,OAAO,EAAE,SAAS,IAAI,YAAY;AAC7C;AAEO,MAAM,wBAAwB;AAAA,EACpC,CAAC,QAAQ,CAAC,SAAS,UAAU,OAAO,EAAE,SAAS,IAAI,YAAY,KAAK,IAAI;AACzE;AAEO,MAAM,gBAAgB;AAAA,EAC5B,CAAC,QACA,CAAC,SAAS,OAAO,EAAE,SAAS,IAAI,YAAY,KAC5C,IAAI,wBACJ,CAAC,IAAI;AACP;AAEO,MAAM,iBAAiB;AAAA,EAC7B,CAAC,QACA,CAAC,SAAS,SAAS,QAAQ,EAAE,SAAS,IAAI,YAAY,KACtD,IAAI,yBACHA,KAAAA,WAAW,IAAI,MAAM,KAAKC,KAAA,YAAY,IAAI,MAAM;AACnD;AAEO,MAAM,mBAAmB;AAAA,EAC/B,CAAC,QACA,CAAC,SAAS,SAAS,QAAQ,EAAE,SAAS,IAAI,YAAY,KACtD,IAAI,wBACJ,CAAC,IAAI,mBACL,CAAC,IAAI;AACP;AAEO,MAAM,6BAA6B;AAAA,EACzC,CAAC,QAAQ,IAAI,mBAAmB,CAAC,IAAI,mBAAmB,IAAI;AAC7D;AAEO,MAAM,2BAA2B;AAAA,EACvC,CAAC,QAAQ,CAAC,IAAI,sBAAsB,CAAC,IAAI;AAC1C;;;;;;;;"}
1
+ {"version":3,"file":"harmony94.cjs","sources":["../src/components/Sidebar/Widgets/ProfileMenu/ProfileMenu.tsx"],"sourcesContent":["import { BillingMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/BillingMenuItem/BillingMenuItem'\nimport { CreateNewTeam } from '@components/Sidebar/Widgets/ProfileMenu/CreateNewTeam/CreateNewTeam'\nimport { CreateNewTeamPlaceholder } from '@components/Sidebar/Widgets/ProfileMenu/CreateNewTeamPlaceholder/CreateNewTeamPlaceholder'\nimport { DarkModeToggle } from '@components/Sidebar/Widgets/ProfileMenu/DarkModeToggle/DarkModeToggle'\nimport { ProfileSettingsMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/ProfileSettingsMenuItem/ProfileSettingsMenuItem'\nimport { ProviderMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/ProviderMenuItem/ProviderMenuItem'\nimport { TeamMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/TeamMenuItem/TeamMenuItem'\nimport { TeamSettingsMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/TeamSettingsMenuItem/TeamSettingsMenuItem'\nimport { TeamSwitch } from '@components/Sidebar/Widgets/ProfileMenu/TeamSwitch/TeamSwitch'\nimport { UpgradeMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/UpgradeMenuItem/UpgradeMenuItem'\nimport { useSidebar } from '@components/Sidebar/hooks/useSidebar'\nimport type { ProfileMenuConfig } from '@components/Sidebar/types'\nimport { Menu, MenuDivider, MenuItem, MenuList, UserIcon } from '@lokalise/louis'\nimport { canAccessProfileSettings, canUpgradePlan } from '@utils/user/permissions'\nimport clsx from 'clsx'\nimport styles from './ProfileMenu.module.css'\nimport { UpgradeIcon } from './UpgradeIcon/UpgradeIcon'\n\n/**\n * The main profile menu component, displaying team and user actions.\n * Renders optional menu items based on the provided config and user permissions.\n *\n * @example\n * ```\n * <ProfileMenu config={...} />\n * ```\n *\n * @note This component must be used within a Sidebar Context.\n */\n\ntype ProfileMenuProps = {\n\tconfig: ProfileMenuConfig\n}\n\nexport const ProfileMenu = ({ config }: ProfileMenuProps) => {\n\tconst {\n\t\tjwt,\n\t\tdata: { currentTeam },\n\t} = useSidebar()\n\n\tconst {\n\t\tdarkModeToggle,\n\t\tteamSwitch,\n\t\tcreateTeam,\n\t\tcreateTeamPlaceholder,\n\t\tupgradeMenuItem,\n\t\tprofileSettings,\n\t} = config\n\n\treturn (\n\t\t<Menu\n\t\t\tmenuButton={() => (\n\t\t\t\t<button className={styles.profileButton} aria-label=\"Profile menu\" type=\"button\">\n\t\t\t\t\t{currentTeam.result?.logoUrl ? (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={currentTeam.result.logoUrl}\n\t\t\t\t\t\t\tclassName={clsx(styles.profileImage, {\n\t\t\t\t\t\t\t\t[styles.profileImageHighlight]: canUpgradePlan(jwt),\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\talt=\"Team Logo\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={clsx(styles.userIconWrapper, 'flex-row', 'align-center', 'items-center', {\n\t\t\t\t\t\t\t\t[styles.profileImageHighlight]: canUpgradePlan(jwt),\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<UserIcon size=\"25px\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t{canUpgradePlan(jwt) && <UpgradeIcon className={styles.profileImageUpgradeIcon} />}\n\t\t\t\t</button>\n\t\t\t)}\n\t\t>\n\t\t\t<MenuList placement=\"right-end\" className={styles.menuContainer}>\n\t\t\t\t{teamSwitch && <TeamSwitch onSwitchTeam={teamSwitch.onSwitchTeam} />}\n\t\t\t\t{createTeam && <CreateNewTeam onCreateTeam={createTeam.onCreateTeam} />}\n\t\t\t\t{createTeamPlaceholder && (\n\t\t\t\t\t<CreateNewTeamPlaceholder onClick={createTeamPlaceholder.onClick} />\n\t\t\t\t)}\n\t\t\t\t<TeamMenuItem />\n\t\t\t\t{upgradeMenuItem && <UpgradeMenuItem href={upgradeMenuItem.href} />}\n\t\t\t\t<BillingMenuItem />\n\t\t\t\t<TeamSettingsMenuItem />\n\t\t\t\t<ProviderMenuItem />\n\t\t\t\t<MenuDivider />\n\n\t\t\t\t{profileSettings && <ProfileSettingsMenuItem />}\n\t\t\t\t{darkModeToggle && <DarkModeToggle {...darkModeToggle} />}\n\t\t\t\t{((profileSettings && canAccessProfileSettings(jwt)) || darkModeToggle) && <MenuDivider />}\n\n\t\t\t\t<MenuItem href=\"/login?action=logout\">Logout</MenuItem>\n\t\t\t</MenuList>\n\t\t</Menu>\n\t)\n}\n"],"names":["useSidebar","jsx","Menu","jsxs","styles","clsx","canUpgradePlan","UserIcon","UpgradeIcon","MenuList","TeamSwitch","CreateNewTeam","CreateNewTeamPlaceholder","TeamMenuItem","UpgradeMenuItem","BillingMenuItem","TeamSettingsMenuItem","ProviderMenuItem","MenuDivider","ProfileSettingsMenuItem","DarkModeToggle","canAccessProfileSettings","MenuItem"],"mappings":";;;;;;;;;;;;;;;;;;;AAkCO,MAAM,cAAc,CAAC,EAAE,aAA+B;AACtD,QAAA;AAAA,IACL;AAAA,IACA,MAAM,EAAE,YAAY;AAAA,MACjBA,sBAAW;AAET,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAGH,SAAAC,2BAAA;AAAA,IAACC,MAAA;AAAA,IAAA;AAAA,MACA,YAAY,MACXC;;AAAAA,0CAAAA,KAAC,UAAO,EAAA,WAAWC,mBAAAA,QAAO,eAAe,cAAW,gBAAe,MAAK,UACtE,UAAA;AAAA,YAAA,iBAAY,WAAZ,mBAAoB,WACpBH,2BAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,KAAK,YAAY,OAAO;AAAA,cACxB,WAAWI,KAAAA,KAAKD,mBAAA,QAAO,cAAc;AAAA,gBACpC,CAACA,mBAAA,QAAO,qBAAqB,GAAGE,YAAAA,eAAe,GAAG;AAAA,cAAA,CAClD;AAAA,cACD,KAAI;AAAA,YAAA;AAAA,UAAA,IAGLL,2BAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,WAAWI,KAAK,KAAAD,mBAAA,QAAO,iBAAiB,YAAY,gBAAgB,gBAAgB;AAAA,gBACnF,CAACA,mBAAA,QAAO,qBAAqB,GAAGE,YAAAA,eAAe,GAAG;AAAA,cAAA,CAClD;AAAA,cAED,UAAAL,2BAAAA,IAACM,MAAAA,UAAS,EAAA,MAAK,OAAO,CAAA;AAAA,YAAA;AAAA,UACvB;AAAA,UAEAD,2BAAe,GAAG,oCAAME,YAAY,aAAA,EAAA,WAAWJ,2BAAO,wBAAyB,CAAA;AAAA,QAAA,GACjF;AAAA;AAAA,MAGD,0CAACK,MAAS,UAAA,EAAA,WAAU,aAAY,WAAWL,mBAAAA,QAAO,eAChD,UAAA;AAAA,QAAA,cAAeH,2BAAA,IAAAS,WAAA,YAAA,EAAW,cAAc,WAAW,cAAc;AAAA,QACjE,cAAcT,2BAAA,IAACU,cAAc,eAAA,EAAA,cAAc,WAAW,cAAc;AAAA,QACpE,yBACAV,2BAAA,IAACW,yBAAyB,0BAAA,EAAA,SAAS,sBAAsB,SAAS;AAAA,uCAElEC,aAAa,cAAA,EAAA;AAAA,QACb,mBAAmBZ,2BAAA,IAACa,gBAAgB,iBAAA,EAAA,MAAM,gBAAgB,MAAM;AAAA,uCAChEC,gBAAgB,iBAAA,EAAA;AAAA,uCAChBC,qBAAqB,sBAAA,EAAA;AAAA,uCACrBC,iBAAiB,kBAAA,EAAA;AAAA,uCACjBC,MAAY,aAAA,EAAA;AAAA,QAEZ,kDAAoBC,wBAAwB,yBAAA,EAAA;AAAA,QAC5C,kBAAkBlB,2BAAAA,IAACmB,eAAAA,gBAAgB,EAAA,GAAG,eAAgB,CAAA;AAAA,SACpD,mBAAmBC,YAAAA,yBAAyB,GAAG,KAAM,kDAAoBH,MAAY,aAAA,EAAA;AAAA,QAEvFjB,2BAAA,IAAAqB,MAAA,UAAA,EAAS,MAAK,wBAAuB,UAAM,SAAA,CAAA;AAAA,MAAA,EAC7C,CAAA;AAAA,IAAA;AAAA,EACD;AAEF;;"}
@@ -1,33 +1,79 @@
1
- import { isFreePlan, isTrialPlan } from "./harmony9.mjs";
2
- const withJwtCheck = (checkFn) => (jwtPayload) => !!jwtPayload && checkFn(jwtPayload);
3
- const canAccessReporting = withJwtCheck(
4
- (jwt) => ["admin", "owner"].includes(jwt.userTeamRole)
5
- );
6
- const canAccessTeamSettings = withJwtCheck(
7
- (jwt) => ["admin", "biller", "owner"].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated
8
- );
9
- const canCreateTeam = withJwtCheck(
10
- (jwt) => ["admin", "owner"].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated && !jwt.isEndOfTrialActive
11
- );
12
- const canUpgradePlan = withJwtCheck(
13
- (jwt) => ["admin", "owner", "biller"].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated && (isFreePlan(jwt.planId) || isTrialPlan(jwt.planId))
14
- );
15
- const canChangeBilling = withJwtCheck(
16
- (jwt) => ["admin", "owner", "biller"].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated && !jwt.isTeamSuspended && !jwt.isEndOfTrialActive
17
- );
18
- const canAccessProviderDashboard = withJwtCheck(
19
- (jwt) => jwt.isProviderAlpha && !jwt.isTeamSuspended && jwt.isFullyAuthenticated
20
- );
21
- const canAccessProfileSettings = withJwtCheck(
22
- (jwt) => !jwt.isEndOfTrialActive && !jwt.isTeamSuspended
23
- );
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { BillingMenuItem } from "./harmony108.mjs";
3
+ import { CreateNewTeam } from "./harmony109.mjs";
4
+ import { CreateNewTeamPlaceholder } from "./harmony110.mjs";
5
+ import { DarkModeToggle } from "./harmony111.mjs";
6
+ import { ProfileSettingsMenuItem } from "./harmony112.mjs";
7
+ import { ProviderMenuItem } from "./harmony113.mjs";
8
+ import { TeamMenuItem } from "./harmony114.mjs";
9
+ import { TeamSettingsMenuItem } from "./harmony115.mjs";
10
+ import { TeamSwitch } from "./harmony116.mjs";
11
+ import { UpgradeMenuItem } from "./harmony117.mjs";
12
+ import { useSidebar } from "./harmony95.mjs";
13
+ import { Menu, MenuList, MenuDivider, MenuItem, UserIcon } from "@lokalise/louis";
14
+ import { canAccessProfileSettings, canUpgradePlan } from "./harmony96.mjs";
15
+ import { clsx } from "./harmony73.mjs";
16
+ import styles from "./harmony118.mjs";
17
+ import { UpgradeIcon } from "./harmony119.mjs";
18
+ const ProfileMenu = ({ config }) => {
19
+ const {
20
+ jwt,
21
+ data: { currentTeam }
22
+ } = useSidebar();
23
+ const {
24
+ darkModeToggle,
25
+ teamSwitch,
26
+ createTeam,
27
+ createTeamPlaceholder,
28
+ upgradeMenuItem,
29
+ profileSettings
30
+ } = config;
31
+ return /* @__PURE__ */ jsx(
32
+ Menu,
33
+ {
34
+ menuButton: () => {
35
+ var _a;
36
+ return /* @__PURE__ */ jsxs("button", { className: styles.profileButton, "aria-label": "Profile menu", type: "button", children: [
37
+ ((_a = currentTeam.result) == null ? void 0 : _a.logoUrl) ? /* @__PURE__ */ jsx(
38
+ "img",
39
+ {
40
+ src: currentTeam.result.logoUrl,
41
+ className: clsx(styles.profileImage, {
42
+ [styles.profileImageHighlight]: canUpgradePlan(jwt)
43
+ }),
44
+ alt: "Team Logo"
45
+ }
46
+ ) : /* @__PURE__ */ jsx(
47
+ "div",
48
+ {
49
+ className: clsx(styles.userIconWrapper, "flex-row", "align-center", "items-center", {
50
+ [styles.profileImageHighlight]: canUpgradePlan(jwt)
51
+ }),
52
+ children: /* @__PURE__ */ jsx(UserIcon, { size: "25px" })
53
+ }
54
+ ),
55
+ canUpgradePlan(jwt) && /* @__PURE__ */ jsx(UpgradeIcon, { className: styles.profileImageUpgradeIcon })
56
+ ] });
57
+ },
58
+ children: /* @__PURE__ */ jsxs(MenuList, { placement: "right-end", className: styles.menuContainer, children: [
59
+ teamSwitch && /* @__PURE__ */ jsx(TeamSwitch, { onSwitchTeam: teamSwitch.onSwitchTeam }),
60
+ createTeam && /* @__PURE__ */ jsx(CreateNewTeam, { onCreateTeam: createTeam.onCreateTeam }),
61
+ createTeamPlaceholder && /* @__PURE__ */ jsx(CreateNewTeamPlaceholder, { onClick: createTeamPlaceholder.onClick }),
62
+ /* @__PURE__ */ jsx(TeamMenuItem, {}),
63
+ upgradeMenuItem && /* @__PURE__ */ jsx(UpgradeMenuItem, { href: upgradeMenuItem.href }),
64
+ /* @__PURE__ */ jsx(BillingMenuItem, {}),
65
+ /* @__PURE__ */ jsx(TeamSettingsMenuItem, {}),
66
+ /* @__PURE__ */ jsx(ProviderMenuItem, {}),
67
+ /* @__PURE__ */ jsx(MenuDivider, {}),
68
+ profileSettings && /* @__PURE__ */ jsx(ProfileSettingsMenuItem, {}),
69
+ darkModeToggle && /* @__PURE__ */ jsx(DarkModeToggle, { ...darkModeToggle }),
70
+ (profileSettings && canAccessProfileSettings(jwt) || darkModeToggle) && /* @__PURE__ */ jsx(MenuDivider, {}),
71
+ /* @__PURE__ */ jsx(MenuItem, { href: "/login?action=logout", children: "Logout" })
72
+ ] })
73
+ }
74
+ );
75
+ };
24
76
  export {
25
- canAccessProfileSettings,
26
- canAccessProviderDashboard,
27
- canAccessReporting,
28
- canAccessTeamSettings,
29
- canChangeBilling,
30
- canCreateTeam,
31
- canUpgradePlan
77
+ ProfileMenu
32
78
  };
33
79
  //# sourceMappingURL=harmony94.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony94.mjs","sources":["../src/utils/user/permissions.ts"],"sourcesContent":["import type { JwtTokenPayload } from '@features/auth/core/types/jwtTokenPayload'\nimport { isFreePlan, isTrialPlan } from '@utils'\n\ntype JwtCheckFn = (jwt: JwtTokenPayload) => boolean\n\nconst withJwtCheck =\n\t(checkFn: JwtCheckFn) =>\n\t(jwtPayload: JwtTokenPayload | null | undefined): boolean =>\n\t\t!!jwtPayload && checkFn(jwtPayload)\n\nexport const canAccessStyleGuide = withJwtCheck((jwt) =>\n\t['admin', 'biller', 'owner'].includes(jwt.userTeamRole),\n)\n\nexport const canAccessReporting = withJwtCheck((jwt) =>\n\t['admin', 'owner'].includes(jwt.userTeamRole),\n)\n\nexport const canAccessTeamSettings = withJwtCheck(\n\t(jwt) => ['admin', 'biller', 'owner'].includes(jwt.userTeamRole) && jwt.isFullyAuthenticated,\n)\n\nexport const canCreateTeam = withJwtCheck(\n\t(jwt) =>\n\t\t['admin', 'owner'].includes(jwt.userTeamRole) &&\n\t\tjwt.isFullyAuthenticated &&\n\t\t!jwt.isEndOfTrialActive,\n)\n\nexport const canUpgradePlan = withJwtCheck(\n\t(jwt) =>\n\t\t['admin', 'owner', 'biller'].includes(jwt.userTeamRole) &&\n\t\tjwt.isFullyAuthenticated &&\n\t\t(isFreePlan(jwt.planId) || isTrialPlan(jwt.planId)),\n)\n\nexport const canChangeBilling = withJwtCheck(\n\t(jwt) =>\n\t\t['admin', 'owner', 'biller'].includes(jwt.userTeamRole) &&\n\t\tjwt.isFullyAuthenticated &&\n\t\t!jwt.isTeamSuspended &&\n\t\t!jwt.isEndOfTrialActive,\n)\n\nexport const canAccessProviderDashboard = withJwtCheck(\n\t(jwt) => jwt.isProviderAlpha && !jwt.isTeamSuspended && jwt.isFullyAuthenticated,\n)\n\nexport const canAccessProfileSettings = withJwtCheck(\n\t(jwt) => !jwt.isEndOfTrialActive && !jwt.isTeamSuspended,\n)\n"],"names":[],"mappings":";AAKA,MAAM,eACL,CAAC,YACD,CAAC,eACA,CAAC,CAAC,cAAc,QAAQ,UAAU;AAM7B,MAAM,qBAAqB;AAAA,EAAa,CAAC,QAC/C,CAAC,SAAS,OAAO,EAAE,SAAS,IAAI,YAAY;AAC7C;AAEO,MAAM,wBAAwB;AAAA,EACpC,CAAC,QAAQ,CAAC,SAAS,UAAU,OAAO,EAAE,SAAS,IAAI,YAAY,KAAK,IAAI;AACzE;AAEO,MAAM,gBAAgB;AAAA,EAC5B,CAAC,QACA,CAAC,SAAS,OAAO,EAAE,SAAS,IAAI,YAAY,KAC5C,IAAI,wBACJ,CAAC,IAAI;AACP;AAEO,MAAM,iBAAiB;AAAA,EAC7B,CAAC,QACA,CAAC,SAAS,SAAS,QAAQ,EAAE,SAAS,IAAI,YAAY,KACtD,IAAI,yBACH,WAAW,IAAI,MAAM,KAAK,YAAY,IAAI,MAAM;AACnD;AAEO,MAAM,mBAAmB;AAAA,EAC/B,CAAC,QACA,CAAC,SAAS,SAAS,QAAQ,EAAE,SAAS,IAAI,YAAY,KACtD,IAAI,wBACJ,CAAC,IAAI,mBACL,CAAC,IAAI;AACP;AAEO,MAAM,6BAA6B;AAAA,EACzC,CAAC,QAAQ,IAAI,mBAAmB,CAAC,IAAI,mBAAmB,IAAI;AAC7D;AAEO,MAAM,2BAA2B;AAAA,EACvC,CAAC,QAAQ,CAAC,IAAI,sBAAsB,CAAC,IAAI;AAC1C;"}
1
+ {"version":3,"file":"harmony94.mjs","sources":["../src/components/Sidebar/Widgets/ProfileMenu/ProfileMenu.tsx"],"sourcesContent":["import { BillingMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/BillingMenuItem/BillingMenuItem'\nimport { CreateNewTeam } from '@components/Sidebar/Widgets/ProfileMenu/CreateNewTeam/CreateNewTeam'\nimport { CreateNewTeamPlaceholder } from '@components/Sidebar/Widgets/ProfileMenu/CreateNewTeamPlaceholder/CreateNewTeamPlaceholder'\nimport { DarkModeToggle } from '@components/Sidebar/Widgets/ProfileMenu/DarkModeToggle/DarkModeToggle'\nimport { ProfileSettingsMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/ProfileSettingsMenuItem/ProfileSettingsMenuItem'\nimport { ProviderMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/ProviderMenuItem/ProviderMenuItem'\nimport { TeamMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/TeamMenuItem/TeamMenuItem'\nimport { TeamSettingsMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/TeamSettingsMenuItem/TeamSettingsMenuItem'\nimport { TeamSwitch } from '@components/Sidebar/Widgets/ProfileMenu/TeamSwitch/TeamSwitch'\nimport { UpgradeMenuItem } from '@components/Sidebar/Widgets/ProfileMenu/UpgradeMenuItem/UpgradeMenuItem'\nimport { useSidebar } from '@components/Sidebar/hooks/useSidebar'\nimport type { ProfileMenuConfig } from '@components/Sidebar/types'\nimport { Menu, MenuDivider, MenuItem, MenuList, UserIcon } from '@lokalise/louis'\nimport { canAccessProfileSettings, canUpgradePlan } from '@utils/user/permissions'\nimport clsx from 'clsx'\nimport styles from './ProfileMenu.module.css'\nimport { UpgradeIcon } from './UpgradeIcon/UpgradeIcon'\n\n/**\n * The main profile menu component, displaying team and user actions.\n * Renders optional menu items based on the provided config and user permissions.\n *\n * @example\n * ```\n * <ProfileMenu config={...} />\n * ```\n *\n * @note This component must be used within a Sidebar Context.\n */\n\ntype ProfileMenuProps = {\n\tconfig: ProfileMenuConfig\n}\n\nexport const ProfileMenu = ({ config }: ProfileMenuProps) => {\n\tconst {\n\t\tjwt,\n\t\tdata: { currentTeam },\n\t} = useSidebar()\n\n\tconst {\n\t\tdarkModeToggle,\n\t\tteamSwitch,\n\t\tcreateTeam,\n\t\tcreateTeamPlaceholder,\n\t\tupgradeMenuItem,\n\t\tprofileSettings,\n\t} = config\n\n\treturn (\n\t\t<Menu\n\t\t\tmenuButton={() => (\n\t\t\t\t<button className={styles.profileButton} aria-label=\"Profile menu\" type=\"button\">\n\t\t\t\t\t{currentTeam.result?.logoUrl ? (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={currentTeam.result.logoUrl}\n\t\t\t\t\t\t\tclassName={clsx(styles.profileImage, {\n\t\t\t\t\t\t\t\t[styles.profileImageHighlight]: canUpgradePlan(jwt),\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\talt=\"Team Logo\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={clsx(styles.userIconWrapper, 'flex-row', 'align-center', 'items-center', {\n\t\t\t\t\t\t\t\t[styles.profileImageHighlight]: canUpgradePlan(jwt),\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<UserIcon size=\"25px\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t{canUpgradePlan(jwt) && <UpgradeIcon className={styles.profileImageUpgradeIcon} />}\n\t\t\t\t</button>\n\t\t\t)}\n\t\t>\n\t\t\t<MenuList placement=\"right-end\" className={styles.menuContainer}>\n\t\t\t\t{teamSwitch && <TeamSwitch onSwitchTeam={teamSwitch.onSwitchTeam} />}\n\t\t\t\t{createTeam && <CreateNewTeam onCreateTeam={createTeam.onCreateTeam} />}\n\t\t\t\t{createTeamPlaceholder && (\n\t\t\t\t\t<CreateNewTeamPlaceholder onClick={createTeamPlaceholder.onClick} />\n\t\t\t\t)}\n\t\t\t\t<TeamMenuItem />\n\t\t\t\t{upgradeMenuItem && <UpgradeMenuItem href={upgradeMenuItem.href} />}\n\t\t\t\t<BillingMenuItem />\n\t\t\t\t<TeamSettingsMenuItem />\n\t\t\t\t<ProviderMenuItem />\n\t\t\t\t<MenuDivider />\n\n\t\t\t\t{profileSettings && <ProfileSettingsMenuItem />}\n\t\t\t\t{darkModeToggle && <DarkModeToggle {...darkModeToggle} />}\n\t\t\t\t{((profileSettings && canAccessProfileSettings(jwt)) || darkModeToggle) && <MenuDivider />}\n\n\t\t\t\t<MenuItem href=\"/login?action=logout\">Logout</MenuItem>\n\t\t\t</MenuList>\n\t\t</Menu>\n\t)\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkCO,MAAM,cAAc,CAAC,EAAE,aAA+B;AACtD,QAAA;AAAA,IACL;AAAA,IACA,MAAM,EAAE,YAAY;AAAA,MACjB,WAAW;AAET,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAGH,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,YAAY,MACX;;AAAA,oCAAC,UAAO,EAAA,WAAW,OAAO,eAAe,cAAW,gBAAe,MAAK,UACtE,UAAA;AAAA,YAAA,iBAAY,WAAZ,mBAAoB,WACpB;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,KAAK,YAAY,OAAO;AAAA,cACxB,WAAW,KAAK,OAAO,cAAc;AAAA,gBACpC,CAAC,OAAO,qBAAqB,GAAG,eAAe,GAAG;AAAA,cAAA,CAClD;AAAA,cACD,KAAI;AAAA,YAAA;AAAA,UAAA,IAGL;AAAA,YAAC;AAAA,YAAA;AAAA,cACA,WAAW,KAAK,OAAO,iBAAiB,YAAY,gBAAgB,gBAAgB;AAAA,gBACnF,CAAC,OAAO,qBAAqB,GAAG,eAAe,GAAG;AAAA,cAAA,CAClD;AAAA,cAED,UAAA,oBAAC,UAAS,EAAA,MAAK,OAAO,CAAA;AAAA,YAAA;AAAA,UACvB;AAAA,UAEA,eAAe,GAAG,yBAAM,aAAY,EAAA,WAAW,OAAO,wBAAyB,CAAA;AAAA,QAAA,GACjF;AAAA;AAAA,MAGD,+BAAC,UAAS,EAAA,WAAU,aAAY,WAAW,OAAO,eAChD,UAAA;AAAA,QAAA,cAAe,oBAAA,YAAA,EAAW,cAAc,WAAW,cAAc;AAAA,QACjE,cAAc,oBAAC,eAAc,EAAA,cAAc,WAAW,cAAc;AAAA,QACpE,yBACA,oBAAC,0BAAyB,EAAA,SAAS,sBAAsB,SAAS;AAAA,4BAElE,cAAa,EAAA;AAAA,QACb,mBAAmB,oBAAC,iBAAgB,EAAA,MAAM,gBAAgB,MAAM;AAAA,4BAChE,iBAAgB,EAAA;AAAA,4BAChB,sBAAqB,EAAA;AAAA,4BACrB,kBAAiB,EAAA;AAAA,4BACjB,aAAY,EAAA;AAAA,QAEZ,uCAAoB,yBAAwB,EAAA;AAAA,QAC5C,kBAAkB,oBAAC,gBAAgB,EAAA,GAAG,eAAgB,CAAA;AAAA,SACpD,mBAAmB,yBAAyB,GAAG,KAAM,uCAAoB,aAAY,EAAA;AAAA,QAEvF,oBAAA,UAAA,EAAS,MAAK,wBAAuB,UAAM,SAAA,CAAA;AAAA,MAAA,EAC7C,CAAA;AAAA,IAAA;AAAA,EACD;AAEF;"}
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const Avatar_module = require("./harmony120.cjs");
5
- const Avatar = ({
6
- src,
7
- href = "/",
8
- ariaLabel = "Lokalise App Home",
9
- alt = "Lokalise Logo"
10
- }) => /* @__PURE__ */ jsxRuntime.jsx("a", { className: Avatar_module.default.logoLink, href, "aria-label": ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt }) });
11
- exports.Avatar = Avatar;
3
+ const SidebarContext = require("./harmony92.cjs");
4
+ const React = require("react");
5
+ const useSidebar = () => {
6
+ const context = React.useContext(SidebarContext.SidebarContext);
7
+ if (!context) {
8
+ throw new Error(
9
+ "You are using useSidebar hook outside its context. Please review your code implementation"
10
+ );
11
+ }
12
+ return context;
13
+ };
14
+ exports.useSidebar = useSidebar;
12
15
  //# sourceMappingURL=harmony95.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony95.cjs","sources":["../src/components/Sidebar/Widgets/Avatar/Avatar.tsx"],"sourcesContent":["import styles from './Avatar.module.css'\n\ntype AvatarProps = {\n\t/** URL of the avatar/logo image */\n\tsrc: string\n\t/** Link destination when avatar is clicked. Defaults to '/' */\n\thref?: string\n\t/** Accessibility label for the avatar link. Defaults to 'Home' */\n\tariaLabel?: string\n\t/** Alt text for the avatar image. Defaults to 'Lokalise' */\n\talt?: string\n}\n\n/**\n * Display company main avatar / logo in the top section of the Sidebar.\n * Used as the main branding element and home navigation link.\n *\n * @example\n * ```\n * <Avatar src=\"/logo.png\" href=\"/\" ariaLabel=\"Home\" alt=\"\" />\n * ```\n */\n\nexport const Avatar = ({\n\tsrc,\n\thref = '/',\n\tariaLabel = 'Lokalise App Home',\n\talt = 'Lokalise Logo',\n}: AvatarProps) => (\n\t<a className={styles.logoLink} href={href} aria-label={ariaLabel}>\n\t\t<img src={src} alt={alt} />\n\t</a>\n)\n"],"names":["jsx","styles"],"mappings":";;;;AAuBO,MAAM,SAAS,CAAC;AAAA,EACtB;AAAA,EACA,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,MAAM;AACP,MACEA,2BAAAA,IAAA,KAAA,EAAE,WAAWC,cAAA,QAAO,UAAU,MAAY,cAAY,WACtD,UAACD,2BAAAA,IAAA,OAAA,EAAI,KAAU,IAAA,CAAU,EAC1B,CAAA;;"}
1
+ {"version":3,"file":"harmony95.cjs","sources":["../src/components/Sidebar/hooks/useSidebar.ts"],"sourcesContent":["import { SidebarContext } from '@components/Sidebar/SidebarContext'\nimport { useContext } from 'react'\n\nexport const useSidebar = () => {\n\tconst context = useContext(SidebarContext)\n\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t'You are using useSidebar hook outside its context. Please review your code implementation',\n\t\t)\n\t}\n\n\treturn context\n}\n"],"names":["useContext","SidebarContext"],"mappings":";;;;AAGO,MAAM,aAAa,MAAM;AACzB,QAAA,UAAUA,iBAAWC,6BAAc;AAEzC,MAAI,CAAC,SAAS;AACb,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EAAA;AAGM,SAAA;AACR;;"}
@@ -1,12 +1,15 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import styles from "./harmony120.mjs";
3
- const Avatar = ({
4
- src,
5
- href = "/",
6
- ariaLabel = "Lokalise App Home",
7
- alt = "Lokalise Logo"
8
- }) => /* @__PURE__ */ jsx("a", { className: styles.logoLink, href, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx("img", { src, alt }) });
1
+ import { SidebarContext } from "./harmony92.mjs";
2
+ import { useContext } from "react";
3
+ const useSidebar = () => {
4
+ const context = useContext(SidebarContext);
5
+ if (!context) {
6
+ throw new Error(
7
+ "You are using useSidebar hook outside its context. Please review your code implementation"
8
+ );
9
+ }
10
+ return context;
11
+ };
9
12
  export {
10
- Avatar
13
+ useSidebar
11
14
  };
12
15
  //# sourceMappingURL=harmony95.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony95.mjs","sources":["../src/components/Sidebar/Widgets/Avatar/Avatar.tsx"],"sourcesContent":["import styles from './Avatar.module.css'\n\ntype AvatarProps = {\n\t/** URL of the avatar/logo image */\n\tsrc: string\n\t/** Link destination when avatar is clicked. Defaults to '/' */\n\thref?: string\n\t/** Accessibility label for the avatar link. Defaults to 'Home' */\n\tariaLabel?: string\n\t/** Alt text for the avatar image. Defaults to 'Lokalise' */\n\talt?: string\n}\n\n/**\n * Display company main avatar / logo in the top section of the Sidebar.\n * Used as the main branding element and home navigation link.\n *\n * @example\n * ```\n * <Avatar src=\"/logo.png\" href=\"/\" ariaLabel=\"Home\" alt=\"\" />\n * ```\n */\n\nexport const Avatar = ({\n\tsrc,\n\thref = '/',\n\tariaLabel = 'Lokalise App Home',\n\talt = 'Lokalise Logo',\n}: AvatarProps) => (\n\t<a className={styles.logoLink} href={href} aria-label={ariaLabel}>\n\t\t<img src={src} alt={alt} />\n\t</a>\n)\n"],"names":[],"mappings":";;AAuBO,MAAM,SAAS,CAAC;AAAA,EACtB;AAAA,EACA,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,MAAM;AACP,MACE,oBAAA,KAAA,EAAE,WAAW,OAAO,UAAU,MAAY,cAAY,WACtD,UAAC,oBAAA,OAAA,EAAI,KAAU,IAAA,CAAU,EAC1B,CAAA;"}
1
+ {"version":3,"file":"harmony95.mjs","sources":["../src/components/Sidebar/hooks/useSidebar.ts"],"sourcesContent":["import { SidebarContext } from '@components/Sidebar/SidebarContext'\nimport { useContext } from 'react'\n\nexport const useSidebar = () => {\n\tconst context = useContext(SidebarContext)\n\n\tif (!context) {\n\t\tthrow new Error(\n\t\t\t'You are using useSidebar hook outside its context. Please review your code implementation',\n\t\t)\n\t}\n\n\treturn context\n}\n"],"names":[],"mappings":";;AAGO,MAAM,aAAa,MAAM;AACzB,QAAA,UAAU,WAAW,cAAc;AAEzC,MAAI,CAAC,SAAS;AACb,UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EAAA;AAGM,SAAA;AACR;"}