@lokalise/harmony 2.0.2 → 2.0.3
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.
- package/dist/harmony102.cjs +1 -1
- package/dist/harmony102.mjs +1 -1
- package/dist/harmony103.cjs +9 -8
- package/dist/harmony103.cjs.map +1 -1
- package/dist/harmony103.mjs +10 -9
- package/dist/harmony103.mjs.map +1 -1
- package/dist/harmony105.cjs +2 -2
- package/dist/harmony105.mjs +2 -2
- package/dist/harmony106.cjs +165 -13
- package/dist/harmony106.cjs.map +1 -1
- package/dist/harmony106.mjs +165 -13
- package/dist/harmony106.mjs.map +1 -1
- package/dist/harmony107.cjs +36 -158
- package/dist/harmony107.cjs.map +1 -1
- package/dist/harmony107.mjs +37 -159
- package/dist/harmony107.mjs.map +1 -1
- package/dist/harmony108.cjs +12 -42
- package/dist/harmony108.cjs.map +1 -1
- package/dist/harmony108.mjs +12 -42
- package/dist/harmony108.mjs.map +1 -1
- package/dist/harmony109.cjs +3 -11
- package/dist/harmony109.cjs.map +1 -1
- package/dist/harmony109.mjs +3 -11
- package/dist/harmony109.mjs.map +1 -1
- package/dist/harmony110.cjs +18 -21
- package/dist/harmony110.cjs.map +1 -1
- package/dist/harmony110.mjs +17 -20
- package/dist/harmony110.mjs.map +1 -1
- package/dist/harmony111.cjs +76 -3
- package/dist/harmony111.cjs.map +1 -1
- package/dist/harmony111.mjs +76 -3
- package/dist/harmony111.mjs.map +1 -1
- package/dist/harmony112.cjs +11 -17
- package/dist/harmony112.cjs.map +1 -1
- package/dist/harmony112.mjs +11 -17
- package/dist/harmony112.mjs.map +1 -1
- package/dist/harmony113.cjs +34 -76
- package/dist/harmony113.cjs.map +1 -1
- package/dist/harmony113.mjs +34 -76
- package/dist/harmony113.mjs.map +1 -1
- package/dist/harmony114.cjs +9 -12
- package/dist/harmony114.cjs.map +1 -1
- package/dist/harmony114.mjs +9 -12
- package/dist/harmony114.mjs.map +1 -1
- package/dist/harmony115.cjs +47 -30
- package/dist/harmony115.cjs.map +1 -1
- package/dist/harmony115.mjs +47 -30
- package/dist/harmony115.mjs.map +1 -1
- package/dist/harmony116.cjs +10 -10
- package/dist/harmony116.cjs.map +1 -1
- package/dist/harmony116.mjs +9 -9
- package/dist/harmony116.mjs.map +1 -1
- package/dist/harmony117.cjs +9 -44
- package/dist/harmony117.cjs.map +1 -1
- package/dist/harmony117.mjs +11 -46
- package/dist/harmony117.mjs.map +1 -1
- package/dist/harmony118.cjs +9 -6
- package/dist/harmony118.cjs.map +1 -1
- package/dist/harmony118.mjs +9 -6
- package/dist/harmony118.mjs.map +1 -1
- package/dist/harmony119.cjs +9 -10
- package/dist/harmony119.cjs.map +1 -1
- package/dist/harmony119.mjs +11 -12
- package/dist/harmony119.mjs.map +1 -1
- package/dist/harmony120.cjs +20 -11
- package/dist/harmony120.cjs.map +1 -1
- package/dist/harmony120.mjs +20 -11
- package/dist/harmony120.mjs.map +1 -1
- package/dist/harmony122.cjs +7 -20
- package/dist/harmony122.cjs.map +1 -1
- package/dist/harmony122.mjs +7 -20
- package/dist/harmony122.mjs.map +1 -1
- package/dist/harmony123.cjs +16 -6
- package/dist/harmony123.cjs.map +1 -1
- package/dist/harmony123.mjs +17 -7
- package/dist/harmony123.mjs.map +1 -1
- package/dist/harmony124.cjs +7 -16
- package/dist/harmony124.cjs.map +1 -1
- package/dist/harmony124.mjs +7 -16
- package/dist/harmony124.mjs.map +1 -1
- package/dist/harmony125.cjs +3 -3
- package/dist/harmony125.cjs.map +1 -1
- package/dist/harmony125.mjs +3 -3
- package/dist/harmony125.mjs.map +1 -1
- package/dist/harmony126.cjs +14 -7
- package/dist/harmony126.cjs.map +1 -1
- package/dist/harmony126.mjs +14 -7
- package/dist/harmony126.mjs.map +1 -1
- package/dist/harmony127.cjs +86 -14
- package/dist/harmony127.cjs.map +1 -1
- package/dist/harmony127.mjs +86 -14
- package/dist/harmony127.mjs.map +1 -1
- package/dist/harmony128.cjs +30 -87
- package/dist/harmony128.cjs.map +1 -1
- package/dist/harmony128.mjs +30 -87
- package/dist/harmony128.mjs.map +1 -1
- package/dist/harmony129.cjs +20 -30
- package/dist/harmony129.cjs.map +1 -1
- package/dist/harmony129.mjs +20 -30
- package/dist/harmony129.mjs.map +1 -1
- package/dist/harmony131.cjs +2 -2
- package/dist/harmony131.mjs +2 -2
- package/dist/harmony132.cjs +2 -2
- package/dist/harmony132.mjs +2 -2
- package/dist/harmony133.cjs +2 -2
- package/dist/harmony133.mjs +2 -2
- package/dist/harmony135.cjs +2 -2
- package/dist/harmony135.mjs +2 -2
- package/dist/harmony136.cjs +2 -2
- package/dist/harmony136.mjs +2 -2
- package/dist/harmony137.cjs +1 -1
- package/dist/harmony137.mjs +1 -1
- package/dist/harmony138.cjs +2 -2
- package/dist/harmony138.mjs +2 -2
- package/dist/harmony139.cjs +1 -1
- package/dist/harmony139.mjs +1 -1
- package/dist/harmony140.cjs +2 -2
- package/dist/harmony140.mjs +2 -2
- package/dist/harmony147.cjs +10 -3
- package/dist/harmony147.cjs.map +1 -1
- package/dist/harmony147.mjs +10 -3
- package/dist/harmony147.mjs.map +1 -1
- package/dist/harmony148.cjs +3 -3
- package/dist/harmony148.cjs.map +1 -1
- package/dist/harmony148.mjs +3 -3
- package/dist/harmony148.mjs.map +1 -1
- package/dist/harmony149.cjs +3 -3
- package/dist/harmony149.cjs.map +1 -1
- package/dist/harmony149.mjs +3 -3
- package/dist/harmony149.mjs.map +1 -1
- package/dist/harmony150.cjs +3 -14
- package/dist/harmony150.cjs.map +1 -1
- package/dist/harmony150.mjs +3 -14
- package/dist/harmony150.mjs.map +1 -1
- package/dist/harmony151.cjs +6 -6
- package/dist/harmony151.cjs.map +1 -1
- package/dist/harmony151.mjs +6 -6
- package/dist/harmony151.mjs.map +1 -1
- package/dist/harmony152.cjs +14 -3
- package/dist/harmony152.cjs.map +1 -1
- package/dist/harmony152.mjs +14 -3
- package/dist/harmony152.mjs.map +1 -1
- package/dist/harmony153.cjs +3 -10
- package/dist/harmony153.cjs.map +1 -1
- package/dist/harmony153.mjs +3 -10
- package/dist/harmony153.mjs.map +1 -1
- package/dist/harmony17.cjs +1 -1
- package/dist/harmony17.mjs +1 -1
- package/dist/harmony20.cjs +1 -1
- package/dist/harmony20.mjs +1 -1
- package/dist/harmony28.cjs +1 -1
- package/dist/harmony28.mjs +1 -1
- package/dist/harmony29.cjs +1 -1
- package/dist/harmony29.mjs +1 -1
- package/dist/harmony32.cjs +1 -1
- package/dist/harmony32.mjs +1 -1
- package/dist/harmony33.cjs +1 -1
- package/dist/harmony33.mjs +1 -1
- package/dist/harmony34.cjs +1 -1
- package/dist/harmony34.mjs +1 -1
- package/dist/harmony39.cjs +1 -1
- package/dist/harmony39.mjs +1 -1
- package/dist/harmony40.cjs +1 -1
- package/dist/harmony40.mjs +1 -1
- package/dist/harmony41.cjs +1 -1
- package/dist/harmony41.mjs +1 -1
- package/dist/harmony42.cjs +2 -2
- package/dist/harmony42.mjs +2 -2
- package/dist/harmony43.cjs +2 -2
- package/dist/harmony43.mjs +2 -2
- package/dist/harmony44.cjs +1 -1
- package/dist/harmony44.mjs +1 -1
- package/dist/harmony96.cjs +2 -2
- package/dist/harmony96.mjs +2 -2
- package/dist/harmony98.cjs +2 -2
- package/dist/harmony98.mjs +2 -2
- package/dist/types/src/components/Sidebar/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/harmony102.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const SidebarContext = require("./
|
|
5
|
+
const SidebarContext = require("./harmony109.cjs");
|
|
6
6
|
const SidebarProvider = ({
|
|
7
7
|
data,
|
|
8
8
|
jwt,
|
package/dist/harmony102.mjs
CHANGED
package/dist/harmony103.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const IconLink = require("./
|
|
5
|
-
const ProfileMenu = require("./
|
|
6
|
-
const useSidebar = require("./
|
|
4
|
+
const IconLink = require("./harmony110.cjs");
|
|
5
|
+
const ProfileMenu = require("./harmony111.cjs");
|
|
6
|
+
const useSidebar = require("./harmony112.cjs");
|
|
7
7
|
const louis = require("@lokalise/louis");
|
|
8
|
-
const permissions = require("./
|
|
9
|
-
const Avatar = require("./
|
|
10
|
-
const HelpMenu = require("./
|
|
11
|
-
const SidebarContent_module = require("./
|
|
8
|
+
const permissions = require("./harmony113.cjs");
|
|
9
|
+
const Avatar = require("./harmony114.cjs");
|
|
10
|
+
const HelpMenu = require("./harmony115.cjs");
|
|
11
|
+
const SidebarContent_module = require("./harmony116.cjs");
|
|
12
12
|
const SidebarContent = ({ widgetsConfig, children, ...navProps }) => {
|
|
13
13
|
const sidebarContextProps = useSidebar.useSidebar();
|
|
14
14
|
const { jwt } = sidebarContextProps;
|
|
15
|
-
const { avatar } = widgetsConfig;
|
|
15
|
+
const { avatar, styleGuide } = widgetsConfig;
|
|
16
16
|
return /* @__PURE__ */ jsxRuntime.jsxs("nav", { ...navProps, className: SidebarContent_module.default.sidebarContainer, children: [
|
|
17
17
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
18
18
|
/* @__PURE__ */ jsxRuntime.jsx(Avatar.Avatar, { ...avatar }),
|
|
@@ -26,6 +26,7 @@ const SidebarContent = ({ widgetsConfig, children, ...navProps }) => {
|
|
|
26
26
|
)) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: jwt && !jwt.isEndOfTrialActive && !jwt.isTeamSuspended && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
27
27
|
/* @__PURE__ */ jsxRuntime.jsx(IconLink.IconLink, { to: "/projects", label: "Projects", icon: louis.ProjectIcon }),
|
|
28
28
|
/* @__PURE__ */ jsxRuntime.jsx(IconLink.IconLink, { to: "/order", label: "Order", icon: louis.ShoppingBagIcon }),
|
|
29
|
+
(styleGuide == null ? void 0 : styleGuide.enabled) && permissions.canAccessStyleGuide(jwt) && /* @__PURE__ */ jsxRuntime.jsx(IconLink.IconLink, { to: "/style-guide", label: "Style Guide", icon: louis.StyleguideIcon }),
|
|
29
30
|
permissions.canAccessReporting(jwt) && /* @__PURE__ */ jsxRuntime.jsx(IconLink.IconLink, { to: "/analytics", label: "Analytics", icon: louis.ChartLineIcon })
|
|
30
31
|
] }) }),
|
|
31
32
|
/* @__PURE__ */ jsxRuntime.jsx(HelpMenu.HelpMenu, { ...widgetsConfig.helpMenu })
|
package/dist/harmony103.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harmony103.cjs","sources":["../src/components/Sidebar/SidebarContent/SidebarContent.tsx"],"sourcesContent":["import { IconLink } from '@components/Sidebar/Widgets/IconLink/IconLink'\nimport { ProfileMenu } from '@components/Sidebar/Widgets/ProfileMenu/ProfileMenu'\nimport { useSidebar } from '@components/Sidebar/hooks/useSidebar'\nimport type { SidebarWidgetsConfig } from '@components/Sidebar/types'\nimport type { SidebarContextProps } from '@components/Sidebar/types'\nimport {
|
|
1
|
+
{"version":3,"file":"harmony103.cjs","sources":["../src/components/Sidebar/SidebarContent/SidebarContent.tsx"],"sourcesContent":["import { IconLink } from '@components/Sidebar/Widgets/IconLink/IconLink'\nimport { ProfileMenu } from '@components/Sidebar/Widgets/ProfileMenu/ProfileMenu'\nimport { useSidebar } from '@components/Sidebar/hooks/useSidebar'\nimport type { SidebarWidgetsConfig } from '@components/Sidebar/types'\nimport type { SidebarContextProps } from '@components/Sidebar/types'\nimport {\n\tChartLineIcon,\n\tProjectIcon,\n\tRectangle,\n\tShoppingBagIcon,\n\tSkeleton,\n\tStyleguideIcon,\n} from '@lokalise/louis'\nimport { canAccessReporting, canAccessStyleGuide } from '@utils/user/permissions'\nimport type { HTMLProps, ReactNode } from 'react'\nimport { Avatar } from '../Widgets/Avatar/Avatar'\nimport { HelpMenu } from '../Widgets/HelpMenu/HelpMenu'\nimport styles from './SidebarContent.module.css'\n\nexport type SidebarContentProps = Omit<HTMLProps<HTMLElement>, 'children'> & {\n\twidgetsConfig: SidebarWidgetsConfig\n\tchildren?: ((props: SidebarContextProps) => ReactNode) | ReactNode\n}\n\nexport const SidebarContent = ({ widgetsConfig, children, ...navProps }: SidebarContentProps) => {\n\tconst sidebarContextProps = useSidebar()\n\n\tconst { jwt } = sidebarContextProps\n\n\tconst { avatar, styleGuide } = widgetsConfig\n\n\treturn (\n\t\t<nav {...navProps} className={styles.sidebarContainer}>\n\t\t\t<div>\n\t\t\t\t<Avatar {...avatar} />\n\n\t\t\t\t{!jwt ? (\n\t\t\t\t\t<Skeleton description={'Top Section Loader'} animated className={styles.sidebarSkeleton}>\n\t\t\t\t\t\t{Array.from({ length: 3 }).map(() => (\n\t\t\t\t\t\t\t<Rectangle\n\t\t\t\t\t\t\t\tkey={`sidebar-top-widget-loader-${crypto.randomUUID()}`}\n\t\t\t\t\t\t\t\theight={40}\n\t\t\t\t\t\t\t\twidth={40}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</Skeleton>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{jwt && !jwt.isEndOfTrialActive && !jwt.isTeamSuspended && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{/** TODO - All URLs should be pointing to Expert here. We need resolve URL function to deal with this */}\n\t\t\t\t\t\t\t\t<IconLink to=\"/projects\" label={'Projects'} icon={ProjectIcon} />\n\t\t\t\t\t\t\t\t<IconLink to=\"/order\" label=\"Order\" icon={ShoppingBagIcon} />\n\n\t\t\t\t\t\t\t\t{styleGuide?.enabled && canAccessStyleGuide(jwt) && (\n\t\t\t\t\t\t\t\t\t<IconLink to=\"/style-guide\" label=\"Style Guide\" icon={StyleguideIcon} />\n\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t{canAccessReporting(jwt) && (\n\t\t\t\t\t\t\t\t\t<IconLink to=\"/analytics\" label=\"Analytics\" icon={ChartLineIcon} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t<HelpMenu {...widgetsConfig.helpMenu} />\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t{children && typeof children === 'function' ? children(sidebarContextProps) : children}\n\t\t\t\t<ProfileMenu config={widgetsConfig.profileMenu} />\n\t\t\t</div>\n\t\t</nav>\n\t)\n}\n"],"names":["useSidebar","styles","jsxs","jsx","Avatar","Skeleton","Rectangle","Fragment","IconLink","ProjectIcon","ShoppingBagIcon","canAccessStyleGuide","StyleguideIcon","canAccessReporting","ChartLineIcon","HelpMenu","ProfileMenu"],"mappings":";;;;;;;;;;;AAwBO,MAAM,iBAAiB,CAAC,EAAE,eAAe,UAAU,GAAG,eAAoC;AAChG,QAAM,sBAAsBA,WAAAA,WAAW;AAEjC,QAAA,EAAE,QAAQ;AAEV,QAAA,EAAE,QAAQ,WAAA,IAAe;AAE/B,yCACE,OAAK,EAAA,GAAG,UAAU,WAAWC,8BAAO,kBACpC,UAAA;AAAA,IAAAC,gCAAC,OACA,EAAA,UAAA;AAAA,MAACC,2BAAAA,IAAAC,OAAA,QAAA,EAAQ,GAAG,QAAQ;AAAA,MAEnB,CAAC,MACDD,2BAAA,IAACE,kBAAS,aAAa,sBAAsB,UAAQ,MAAC,WAAWJ,sBAAAA,QAAO,iBACtE,UAAA,MAAM,KAAK,EAAE,QAAQ,EAAG,CAAA,EAAE,IAAI,MAC9BE,2BAAA;AAAA,QAACG,MAAA;AAAA,QAAA;AAAA,UAEA,QAAQ;AAAA,UACR,OAAO;AAAA,QAAA;AAAA,QAFF,6BAA6B,OAAO,YAAY;AAAA,MAAA,CAItD,EACF,CAAA,IAGEH,2BAAA,IAAAI,WAAA,UAAA,EAAA,UAAA,OAAO,CAAC,IAAI,sBAAsB,CAAC,IAAI,mBAGtCL,2BAAAA,KAAAK,WAAAA,UAAA,EAAA,UAAA;AAAA,QAAAJ,+BAACK,SAAAA,YAAS,IAAG,aAAY,OAAO,YAAY,MAAMC,MAAAA,aAAa;AAAA,uCAC9DD,SAAAA,UAAS,EAAA,IAAG,UAAS,OAAM,SAAQ,MAAME,MAAAA,iBAAiB;AAAA,SAE1D,yCAAY,YAAWC,YAAAA,oBAAoB,GAAG,KAC9CR,2BAAA,IAACK,SAAS,UAAA,EAAA,IAAG,gBAAe,OAAM,eAAc,MAAMI,MAAgB,eAAA,CAAA;AAAA,QAGtEC,YAAAA,mBAAmB,GAAG,KACrBV,2BAAA,IAAAK,mBAAA,EAAS,IAAG,cAAa,OAAM,aAAY,MAAMM,MAAAA,cAAe,CAAA;AAAA,MAAA,EAAA,CAEnE,EAEF,CAAA;AAAA,MAEAX,2BAAAA,IAAAY,SAAA,UAAA,EAAU,GAAG,cAAc,SAAU,CAAA;AAAA,IAAA,GACvC;AAAA,oCACC,OACC,EAAA,UAAA;AAAA,MAAA,YAAY,OAAO,aAAa,aAAa,SAAS,mBAAmB,IAAI;AAAA,MAC7EZ,2BAAAA,IAAAa,YAAAA,aAAA,EAAY,QAAQ,cAAc,YAAa,CAAA;AAAA,IAAA,EACjD,CAAA;AAAA,EAAA,GACD;AAEF;;"}
|
package/dist/harmony103.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { IconLink } from "./
|
|
3
|
-
import { ProfileMenu } from "./
|
|
4
|
-
import { useSidebar } from "./
|
|
5
|
-
import { Skeleton, Rectangle, ProjectIcon, ShoppingBagIcon, ChartLineIcon } from "@lokalise/louis";
|
|
6
|
-
import { canAccessReporting } from "./
|
|
7
|
-
import { Avatar } from "./
|
|
8
|
-
import { HelpMenu } from "./
|
|
9
|
-
import styles from "./
|
|
2
|
+
import { IconLink } from "./harmony110.mjs";
|
|
3
|
+
import { ProfileMenu } from "./harmony111.mjs";
|
|
4
|
+
import { useSidebar } from "./harmony112.mjs";
|
|
5
|
+
import { Skeleton, Rectangle, ProjectIcon, ShoppingBagIcon, StyleguideIcon, ChartLineIcon } from "@lokalise/louis";
|
|
6
|
+
import { canAccessStyleGuide, canAccessReporting } from "./harmony113.mjs";
|
|
7
|
+
import { Avatar } from "./harmony114.mjs";
|
|
8
|
+
import { HelpMenu } from "./harmony115.mjs";
|
|
9
|
+
import styles from "./harmony116.mjs";
|
|
10
10
|
const SidebarContent = ({ widgetsConfig, children, ...navProps }) => {
|
|
11
11
|
const sidebarContextProps = useSidebar();
|
|
12
12
|
const { jwt } = sidebarContextProps;
|
|
13
|
-
const { avatar } = widgetsConfig;
|
|
13
|
+
const { avatar, styleGuide } = widgetsConfig;
|
|
14
14
|
return /* @__PURE__ */ jsxs("nav", { ...navProps, className: styles.sidebarContainer, children: [
|
|
15
15
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
16
16
|
/* @__PURE__ */ jsx(Avatar, { ...avatar }),
|
|
@@ -24,6 +24,7 @@ const SidebarContent = ({ widgetsConfig, children, ...navProps }) => {
|
|
|
24
24
|
)) }) : /* @__PURE__ */ jsx(Fragment, { children: jwt && !jwt.isEndOfTrialActive && !jwt.isTeamSuspended && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
25
|
/* @__PURE__ */ jsx(IconLink, { to: "/projects", label: "Projects", icon: ProjectIcon }),
|
|
26
26
|
/* @__PURE__ */ jsx(IconLink, { to: "/order", label: "Order", icon: ShoppingBagIcon }),
|
|
27
|
+
(styleGuide == null ? void 0 : styleGuide.enabled) && canAccessStyleGuide(jwt) && /* @__PURE__ */ jsx(IconLink, { to: "/style-guide", label: "Style Guide", icon: StyleguideIcon }),
|
|
27
28
|
canAccessReporting(jwt) && /* @__PURE__ */ jsx(IconLink, { to: "/analytics", label: "Analytics", icon: ChartLineIcon })
|
|
28
29
|
] }) }),
|
|
29
30
|
/* @__PURE__ */ jsx(HelpMenu, { ...widgetsConfig.helpMenu })
|
package/dist/harmony103.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harmony103.mjs","sources":["../src/components/Sidebar/SidebarContent/SidebarContent.tsx"],"sourcesContent":["import { IconLink } from '@components/Sidebar/Widgets/IconLink/IconLink'\nimport { ProfileMenu } from '@components/Sidebar/Widgets/ProfileMenu/ProfileMenu'\nimport { useSidebar } from '@components/Sidebar/hooks/useSidebar'\nimport type { SidebarWidgetsConfig } from '@components/Sidebar/types'\nimport type { SidebarContextProps } from '@components/Sidebar/types'\nimport {
|
|
1
|
+
{"version":3,"file":"harmony103.mjs","sources":["../src/components/Sidebar/SidebarContent/SidebarContent.tsx"],"sourcesContent":["import { IconLink } from '@components/Sidebar/Widgets/IconLink/IconLink'\nimport { ProfileMenu } from '@components/Sidebar/Widgets/ProfileMenu/ProfileMenu'\nimport { useSidebar } from '@components/Sidebar/hooks/useSidebar'\nimport type { SidebarWidgetsConfig } from '@components/Sidebar/types'\nimport type { SidebarContextProps } from '@components/Sidebar/types'\nimport {\n\tChartLineIcon,\n\tProjectIcon,\n\tRectangle,\n\tShoppingBagIcon,\n\tSkeleton,\n\tStyleguideIcon,\n} from '@lokalise/louis'\nimport { canAccessReporting, canAccessStyleGuide } from '@utils/user/permissions'\nimport type { HTMLProps, ReactNode } from 'react'\nimport { Avatar } from '../Widgets/Avatar/Avatar'\nimport { HelpMenu } from '../Widgets/HelpMenu/HelpMenu'\nimport styles from './SidebarContent.module.css'\n\nexport type SidebarContentProps = Omit<HTMLProps<HTMLElement>, 'children'> & {\n\twidgetsConfig: SidebarWidgetsConfig\n\tchildren?: ((props: SidebarContextProps) => ReactNode) | ReactNode\n}\n\nexport const SidebarContent = ({ widgetsConfig, children, ...navProps }: SidebarContentProps) => {\n\tconst sidebarContextProps = useSidebar()\n\n\tconst { jwt } = sidebarContextProps\n\n\tconst { avatar, styleGuide } = widgetsConfig\n\n\treturn (\n\t\t<nav {...navProps} className={styles.sidebarContainer}>\n\t\t\t<div>\n\t\t\t\t<Avatar {...avatar} />\n\n\t\t\t\t{!jwt ? (\n\t\t\t\t\t<Skeleton description={'Top Section Loader'} animated className={styles.sidebarSkeleton}>\n\t\t\t\t\t\t{Array.from({ length: 3 }).map(() => (\n\t\t\t\t\t\t\t<Rectangle\n\t\t\t\t\t\t\t\tkey={`sidebar-top-widget-loader-${crypto.randomUUID()}`}\n\t\t\t\t\t\t\t\theight={40}\n\t\t\t\t\t\t\t\twidth={40}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</Skeleton>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{jwt && !jwt.isEndOfTrialActive && !jwt.isTeamSuspended && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{/** TODO - All URLs should be pointing to Expert here. We need resolve URL function to deal with this */}\n\t\t\t\t\t\t\t\t<IconLink to=\"/projects\" label={'Projects'} icon={ProjectIcon} />\n\t\t\t\t\t\t\t\t<IconLink to=\"/order\" label=\"Order\" icon={ShoppingBagIcon} />\n\n\t\t\t\t\t\t\t\t{styleGuide?.enabled && canAccessStyleGuide(jwt) && (\n\t\t\t\t\t\t\t\t\t<IconLink to=\"/style-guide\" label=\"Style Guide\" icon={StyleguideIcon} />\n\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t{canAccessReporting(jwt) && (\n\t\t\t\t\t\t\t\t\t<IconLink to=\"/analytics\" label=\"Analytics\" icon={ChartLineIcon} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t<HelpMenu {...widgetsConfig.helpMenu} />\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t{children &&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,CAAA;AAAA,IAAA,GACvC;AAAA,yBACC,OACC,EAAA,UAAA;AAAA,MAAA,YAAY,OAAO,aAAa,aAAa,SAAS,mBAAmB,IAAI;AAAA,MAC7E,oBAAA,aAAA,EAAY,QAAQ,cAAc,YAAa,CAAA;AAAA,IAAA,EACjD,CAAA;AAAA,EAAA,GACD;AAEF;"}
|
package/dist/harmony105.cjs
CHANGED
|
@@ -4,8 +4,8 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const louis = require("@lokalise/louis");
|
|
5
5
|
const reactTable = require("@tanstack/react-table");
|
|
6
6
|
const clsx = require("./harmony92.cjs");
|
|
7
|
-
const SortingIcon = require("./
|
|
8
|
-
const TableHeaderCell_module = require("./
|
|
7
|
+
const SortingIcon = require("./harmony117.cjs");
|
|
8
|
+
const TableHeaderCell_module = require("./harmony118.cjs");
|
|
9
9
|
const TableHeaderCell = ({
|
|
10
10
|
header,
|
|
11
11
|
align = "left",
|
package/dist/harmony105.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { TableHeaderCell as TableHeaderCell$1 } from "@lokalise/louis";
|
|
3
3
|
import { flexRender } from "@tanstack/react-table";
|
|
4
4
|
import { clsx } from "./harmony92.mjs";
|
|
5
|
-
import { SortingIcon } from "./
|
|
6
|
-
import styles from "./
|
|
5
|
+
import { SortingIcon } from "./harmony117.mjs";
|
|
6
|
+
import styles from "./harmony118.mjs";
|
|
7
7
|
const TableHeaderCell = ({
|
|
8
8
|
header,
|
|
9
9
|
align = "left",
|
package/dist/harmony106.cjs
CHANGED
|
@@ -1,17 +1,169 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const NavigationClientProvider = require("./harmony16.cjs");
|
|
5
|
+
const toolbarVisibility = require("./harmony127.cjs");
|
|
6
|
+
const useExpertNavigation = (enabled, project, contributor) => {
|
|
7
|
+
const adminRights = (contributor == null ? void 0 : contributor.admin_rights) || [];
|
|
8
|
+
const marketingSupportProjectSelectedAppSlug = "selected-app-slug";
|
|
9
|
+
const navigationClient = NavigationClientProvider.useNavigationClient();
|
|
10
|
+
const expertUrl = navigationClient.getExpertUrl();
|
|
11
|
+
return React.useMemo(() => {
|
|
12
|
+
if (!project || !enabled) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
const navigationVisibility = toolbarVisibility.getProjectNavigationVisibilityMap(
|
|
16
|
+
project,
|
|
17
|
+
adminRights,
|
|
18
|
+
() => true
|
|
19
|
+
);
|
|
20
|
+
const appsNavigationItem = {
|
|
21
|
+
key: "apps",
|
|
22
|
+
label: "Apps",
|
|
23
|
+
isActive: (input) => input === "apps",
|
|
24
|
+
link: `${expertUrl}/apps/${project.project_id}/`,
|
|
25
|
+
...navigationVisibility.apps
|
|
26
|
+
};
|
|
27
|
+
const appsNavigationItemArrInMainMenu = [];
|
|
28
|
+
const appsNavigationItemArrInMoreMenu = [];
|
|
29
|
+
if (project.project_type === "content_integration") {
|
|
30
|
+
appsNavigationItemArrInMoreMenu.push(appsNavigationItem);
|
|
31
|
+
} else {
|
|
32
|
+
appsNavigationItemArrInMainMenu.push(appsNavigationItem);
|
|
33
|
+
}
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
key: "edit",
|
|
37
|
+
label: "Editor",
|
|
38
|
+
link: `${expertUrl}/project/${project.project_id}/`,
|
|
39
|
+
isActive: (input) => input === "edit",
|
|
40
|
+
...navigationVisibility.editor
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "files",
|
|
44
|
+
label: "Files",
|
|
45
|
+
link: `${expertUrl}/files/${project.project_id}/`,
|
|
46
|
+
isActive: (input) => input === "files",
|
|
47
|
+
...navigationVisibility.files
|
|
48
|
+
},
|
|
49
|
+
...project.project_type === "content_integration" ? [
|
|
50
|
+
{
|
|
51
|
+
key: "contentManagement",
|
|
52
|
+
label: "Content management",
|
|
53
|
+
isActive: (input) => input === "apps",
|
|
54
|
+
link: `${expertUrl}/apps/${project.project_id}/${marketingSupportProjectSelectedAppSlug}`,
|
|
55
|
+
...navigationVisibility.contentManagement
|
|
56
|
+
}
|
|
57
|
+
] : [
|
|
58
|
+
{
|
|
59
|
+
key: "upload",
|
|
60
|
+
label: "Upload",
|
|
61
|
+
link: `${expertUrl}/upload/${project.project_id}/`,
|
|
62
|
+
isActive: (input) => input === "upload",
|
|
63
|
+
...navigationVisibility.upload
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "download",
|
|
67
|
+
label: "Download",
|
|
68
|
+
link: `${expertUrl}/download/${project.project_id}/`,
|
|
69
|
+
isActive: (input) => input === "download",
|
|
70
|
+
...navigationVisibility.download
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
{
|
|
74
|
+
key: "tasks",
|
|
75
|
+
label: "Tasks",
|
|
76
|
+
link: `${expertUrl}/tasks/${project.project_id}/`,
|
|
77
|
+
isActive: (input) => input === "tasks",
|
|
78
|
+
// TODO: Add task count
|
|
79
|
+
// badge: taskCount,
|
|
80
|
+
...navigationVisibility.tasks
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: "workflows",
|
|
84
|
+
label: "Workflows",
|
|
85
|
+
link: `${expertUrl}/workflows/${project.project_id}/`,
|
|
86
|
+
isActive: (input) => input === "workflows",
|
|
87
|
+
novel: "New",
|
|
88
|
+
onClick: () => {
|
|
89
|
+
window.location.assign(`${expertUrl}/workflows/${project.project_id}/`);
|
|
90
|
+
},
|
|
91
|
+
...navigationVisibility.workflows
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: "contributors",
|
|
95
|
+
label: "Contributors",
|
|
96
|
+
link: `${expertUrl}/contributors/${project.project_id}/`,
|
|
97
|
+
isActive: (input) => input === "contributors",
|
|
98
|
+
...navigationVisibility.contributors
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "screenshots",
|
|
102
|
+
label: "Screenshots",
|
|
103
|
+
link: `${expertUrl}/screenshots/${project.project_id}/`,
|
|
104
|
+
isActive: (input) => input === "screenshots",
|
|
105
|
+
...navigationVisibility.screenshots
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: "glossary",
|
|
109
|
+
label: "Glossary",
|
|
110
|
+
link: `${expertUrl}/glossary/${project.project_id}/`,
|
|
111
|
+
isActive: (input) => input === "glossary",
|
|
112
|
+
...navigationVisibility.glossary
|
|
113
|
+
},
|
|
114
|
+
...appsNavigationItemArrInMainMenu,
|
|
115
|
+
{
|
|
116
|
+
key: "more",
|
|
117
|
+
label: "More...",
|
|
118
|
+
isActive: (input) => ["settings", "statistics", "duplicates", "live edit"].includes(input),
|
|
119
|
+
...navigationVisibility.more,
|
|
120
|
+
dropdown: [
|
|
121
|
+
[
|
|
122
|
+
{
|
|
123
|
+
link: `${expertUrl}/settings/${project.project_id}/`,
|
|
124
|
+
label: "Settings",
|
|
125
|
+
...navigationVisibility.settings
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
link: `${expertUrl}/settings/${project.project_id}/#branches`,
|
|
129
|
+
label: "Branches",
|
|
130
|
+
...navigationVisibility.branches
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
link: `${expertUrl}/settings/${project.project_id}/#ota-bundles`,
|
|
134
|
+
label: "OTA Bundles",
|
|
135
|
+
...navigationVisibility.otaBundles
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
link: `${expertUrl}/settings/${project.project_id}/#project-automations`,
|
|
139
|
+
label: "Automations",
|
|
140
|
+
...navigationVisibility.automations
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
link: `${expertUrl}/dupes/${project.project_id}/`,
|
|
144
|
+
label: "Duplicate finder",
|
|
145
|
+
...navigationVisibility.duplicateFinder
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
...appsNavigationItemArrInMoreMenu,
|
|
150
|
+
{
|
|
151
|
+
// TODO: This could be problematic tab, because it is not a link and we can't just redirect. We need to find a workaround for that.
|
|
152
|
+
label: "Activity",
|
|
153
|
+
onClick: () => {
|
|
154
|
+
},
|
|
155
|
+
...navigationVisibility.activity
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
link: `${expertUrl}/statistics/${project.project_id}/`,
|
|
159
|
+
label: "Statistics",
|
|
160
|
+
...navigationVisibility.statistics
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
];
|
|
166
|
+
}, [project, adminRights, enabled, expertUrl]);
|
|
13
167
|
};
|
|
14
|
-
|
|
15
|
-
let NewJwtIssuedEvent = _NewJwtIssuedEvent;
|
|
16
|
-
exports.NewJwtIssuedEvent = NewJwtIssuedEvent;
|
|
168
|
+
exports.useExpertNavigation = useExpertNavigation;
|
|
17
169
|
//# sourceMappingURL=harmony106.cjs.map
|
package/dist/harmony106.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harmony106.cjs","sources":["../src/features/auth/frontend/events/NewJwtIssuedEvent.ts"],"sourcesContent":["import type { JwtTokenPayload } from '@features/auth/core/types/jwtTokenPayload'\nimport { parseJwtTokenPayload } from '@features/auth/core/utils/jwtTokenPayload'\nimport type { JwtToken } from '@features/publicApi/types/userTokenTypes'\n\ntype NewJwtIssuedEventDetail = {\n\ttoken: JwtToken\n\tpayload: JwtTokenPayload | undefined\n}\n\n/**\n * This event is emitted when a new JWT token is issued or refreshed.\n */\nexport class NewJwtIssuedEvent extends CustomEvent<NewJwtIssuedEventDetail> {\n\tstatic readonly eventName = 'new-jwt-issued' as const\n\n\tconstructor(token: JwtToken) {\n\t\tsuper(NewJwtIssuedEvent.eventName, {\n\t\t\tdetail: { token, payload: parseJwtTokenPayload(token.accessToken) },\n\t\t})\n\t}\n}\n\nexport const isNewJwtIssuedEvent = (event: Event): event is NewJwtIssuedEvent =>\n\tevent.type === NewJwtIssuedEvent.eventName\n\ndeclare global {\n\tinterface WindowEventMap {\n\t\t[NewJwtIssuedEvent.eventName]: NewJwtIssuedEvent\n\t}\n}\n"],"names":["parseJwtTokenPayload"],"mappings":";;;;;;AAYO,MAAM,qBAAN,MAAM,2BAA0B,YAAqC;AAAA,EAG3E,YAAY,OAAiB;AAC5B,UAAM,mBAAkB,WAAW;AAAA,MAClC,QAAQ,EAAE,OAAO,SAASA,gBAAAA,qBAAqB,MAAM,WAAW,EAAE;AAAA,IAAA,CAClE;AAAA,EAAA;AAEH;AAPC,cADY,oBACI,aAAY;AADtB,IAAM,oBAAN;;"}
|
|
1
|
+
{"version":3,"file":"harmony106.cjs","sources":["../src/features/navigation/hooks/useExpertNavigation.ts"],"sourcesContent":["import type { Contributor, Project } from '@features/node'\nimport { useMemo } from 'react'\nimport { useNavigationClient } from '../providers/NavigationClientProvider'\nimport type { NavigationTabsItem } from '../types/navigation'\nimport { getProjectNavigationVisibilityMap } from '../utils/toolbarVisibility'\n\n// TODO: Validate features types\nexport const getIsFeatureEnabled = (features: Record<string, boolean>, name: string) => {\n\tconst featureState = features[name]\n\n\treturn (\n\t\tfeatureState !== null &&\n\t\tfeatureState !== undefined &&\n\t\t[true, 'on', 'true'].includes(featureState)\n\t)\n}\n\n/**\n * Hook to generate legacy navigation items using the existing structure\n * but with context API instead of Redux\n */\nexport const useExpertNavigation = (\n\tenabled: boolean,\n\tproject?: Project,\n\tcontributor?: Contributor,\n) => {\n\t// Use contributor data if provided, otherwise use defaults\n\tconst adminRights = contributor?.admin_rights || []\n\t// TODO: Implement selected app slug, small investigation is needed\n\tconst marketingSupportProjectSelectedAppSlug = 'selected-app-slug'\n\tconst navigationClient = useNavigationClient()\n\tconst expertUrl = navigationClient.getExpertUrl()\n\n\treturn useMemo(() => {\n\t\t// Get data from contexts instead of Redux, or use provided data\n\t\tif (!project || !enabled) {\n\t\t\treturn []\n\t\t}\n\t\t/* TODO: We're missing badges API. We need to get it from the backend or find alternative way to get task count\n\t\t * Fetch tasks and calculate count is not a good idea, because it can have pagination, therefore we can\n\t\t * ask for an additional prop in tasks response: task_count based on branch_id + project_id + task_status\n\t\t */\n\t\t// const taskCount = getTaskCount(project, branch, badges.tasks)\n\n\t\t// TODO: Implement feature flags functionality, most likely separate package\n\t\t// const isFeatureEnabled = (feature: string) => getIsFeatureEnabled(features, feature)\n\n\t\tconst navigationVisibility = getProjectNavigationVisibilityMap(\n\t\t\tproject,\n\t\t\tadminRights,\n\t\t\t() => true /*isFeatureEnabled*/,\n\t\t)\n\n\t\tconst appsNavigationItem: NavigationTabsItem = {\n\t\t\tkey: 'apps',\n\t\t\tlabel: 'Apps',\n\t\t\tisActive: (input: string) => input === 'apps',\n\t\t\tlink: `${expertUrl}/apps/${project.project_id}/`,\n\t\t\t...navigationVisibility.apps,\n\t\t}\n\n\t\tconst appsNavigationItemArrInMainMenu: NavigationTabsItem[] = []\n\t\tconst appsNavigationItemArrInMoreMenu: NavigationTabsItem[] = []\n\n\t\tif (project.project_type === 'content_integration') {\n\t\t\tappsNavigationItemArrInMoreMenu.push(appsNavigationItem)\n\t\t} else {\n\t\t\tappsNavigationItemArrInMainMenu.push(appsNavigationItem)\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: 'edit',\n\t\t\t\tlabel: 'Editor',\n\t\t\t\tlink: `${expertUrl}/project/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'edit',\n\t\t\t\t...navigationVisibility.editor,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'files',\n\t\t\t\tlabel: 'Files',\n\t\t\t\tlink: `${expertUrl}/files/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'files',\n\t\t\t\t...navigationVisibility.files,\n\t\t\t},\n\t\t\t...(project.project_type === 'content_integration'\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'contentManagement',\n\t\t\t\t\t\t\tlabel: 'Content management',\n\t\t\t\t\t\t\tisActive: (input: string) => input === 'apps',\n\t\t\t\t\t\t\tlink: `${expertUrl}/apps/${project.project_id}/${marketingSupportProjectSelectedAppSlug}`,\n\t\t\t\t\t\t\t...navigationVisibility.contentManagement,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'upload',\n\t\t\t\t\t\t\tlabel: 'Upload',\n\t\t\t\t\t\t\tlink: `${expertUrl}/upload/${project.project_id}/`,\n\t\t\t\t\t\t\tisActive: (input: string) => input === 'upload',\n\t\t\t\t\t\t\t...navigationVisibility.upload,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'download',\n\t\t\t\t\t\t\tlabel: 'Download',\n\t\t\t\t\t\t\tlink: `${expertUrl}/download/${project.project_id}/`,\n\t\t\t\t\t\t\tisActive: (input: string) => input === 'download',\n\t\t\t\t\t\t\t...navigationVisibility.download,\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t{\n\t\t\t\tkey: 'tasks',\n\t\t\t\tlabel: 'Tasks',\n\t\t\t\tlink: `${expertUrl}/tasks/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'tasks',\n\t\t\t\t// TODO: Add task count\n\t\t\t\t// badge: taskCount,\n\t\t\t\t...navigationVisibility.tasks,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'workflows',\n\t\t\t\tlabel: 'Workflows',\n\t\t\t\tlink: `${expertUrl}/workflows/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'workflows',\n\t\t\t\tnovel: 'New',\n\t\t\t\tonClick: () => {\n\t\t\t\t\t// TODO: Resolve analytics globally, most likely separate package\n\t\t\t\t\t// track(AnalyticsEventName.EDITOR_WORKFLOWS_TAB_CLICKED);\n\t\t\t\t\twindow.location.assign(`${expertUrl}/workflows/${project.project_id}/`)\n\t\t\t\t},\n\t\t\t\t...navigationVisibility.workflows,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'contributors',\n\t\t\t\tlabel: 'Contributors',\n\t\t\t\tlink: `${expertUrl}/contributors/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'contributors',\n\t\t\t\t...navigationVisibility.contributors,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'screenshots',\n\t\t\t\tlabel: 'Screenshots',\n\t\t\t\tlink: `${expertUrl}/screenshots/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'screenshots',\n\t\t\t\t...navigationVisibility.screenshots,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'glossary',\n\t\t\t\tlabel: 'Glossary',\n\t\t\t\tlink: `${expertUrl}/glossary/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'glossary',\n\t\t\t\t...navigationVisibility.glossary,\n\t\t\t},\n\t\t\t...appsNavigationItemArrInMainMenu,\n\t\t\t{\n\t\t\t\tkey: 'more',\n\t\t\t\tlabel: 'More...',\n\t\t\t\tisActive: (input: string) =>\n\t\t\t\t\t['settings', 'statistics', 'duplicates', 'live edit'].includes(input),\n\t\t\t\t...navigationVisibility.more,\n\t\t\t\tdropdown: [\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/settings/${project.project_id}/`,\n\t\t\t\t\t\t\tlabel: 'Settings',\n\t\t\t\t\t\t\t...navigationVisibility.settings,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/settings/${project.project_id}/#branches`,\n\t\t\t\t\t\t\tlabel: 'Branches',\n\t\t\t\t\t\t\t...navigationVisibility.branches,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/settings/${project.project_id}/#ota-bundles`,\n\t\t\t\t\t\t\tlabel: 'OTA Bundles',\n\t\t\t\t\t\t\t...navigationVisibility.otaBundles,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/settings/${project.project_id}/#project-automations`,\n\t\t\t\t\t\t\tlabel: 'Automations',\n\t\t\t\t\t\t\t...navigationVisibility.automations,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/dupes/${project.project_id}/`,\n\t\t\t\t\t\t\tlabel: 'Duplicate finder',\n\t\t\t\t\t\t\t...navigationVisibility.duplicateFinder,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t[\n\t\t\t\t\t\t...appsNavigationItemArrInMoreMenu,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO: This could be problematic tab, because it is not a link and we can't just redirect. We need to find a workaround for that.\n\t\t\t\t\t\t\tlabel: 'Activity',\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t// const showActivityEvent = new CustomEvent(\"show-activity\", {\n\t\t\t\t\t\t\t\t// \tdetail: {\n\t\t\t\t\t\t\t\t// \t\tprojectId: project.id,\n\t\t\t\t\t\t\t\t// \t\tbranchId: branch.branchId,\n\t\t\t\t\t\t\t\t// \t\tbranchName: branch.branchName,\n\t\t\t\t\t\t\t\t// \t},\n\t\t\t\t\t\t\t\t// });\n\t\t\t\t\t\t\t\t// document.dispatchEvent(showActivityEvent);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...navigationVisibility.activity,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/statistics/${project.project_id}/`,\n\t\t\t\t\t\t\tlabel: 'Statistics',\n\t\t\t\t\t\t\t...navigationVisibility.statistics,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t},\n\t\t]\n\t}, [project, adminRights, enabled, expertUrl])\n}\n\n// TODO: Helper function for getting task count from badge data\n// const _getTaskCount = (project: any, branch: any, taskBadges: any) => {\n// \tif (!taskBadges) return 0\n\n// \t// Implementation would depend on your getTaskCountFromTasks utility\n// \t// Simplified version:\n// \tconst projectTasks = taskBadges[project.id] || {}\n// \treturn projectTasks[branch.branchId || 'master'] || 0\n// }\n"],"names":["useNavigationClient","useMemo","getProjectNavigationVisibilityMap"],"mappings":";;;;;AAqBO,MAAM,sBAAsB,CAClC,SACA,SACA,gBACI;AAEE,QAAA,eAAc,2CAAa,iBAAgB,CAAC;AAElD,QAAM,yCAAyC;AAC/C,QAAM,mBAAmBA,yBAAAA,oBAAoB;AACvC,QAAA,YAAY,iBAAiB,aAAa;AAEhD,SAAOC,cAAQ,MAAM;AAEhB,QAAA,CAAC,WAAW,CAAC,SAAS;AACzB,aAAO,CAAC;AAAA,IAAA;AAWT,UAAM,uBAAuBC,kBAAA;AAAA,MAC5B;AAAA,MACA;AAAA,MACA,MAAM;AAAA,IACP;AAEA,UAAM,qBAAyC;AAAA,MAC9C,KAAK;AAAA,MACL,OAAO;AAAA,MACP,UAAU,CAAC,UAAkB,UAAU;AAAA,MACvC,MAAM,GAAG,SAAS,SAAS,QAAQ,UAAU;AAAA,MAC7C,GAAG,qBAAqB;AAAA,IACzB;AAEA,UAAM,kCAAwD,CAAC;AAC/D,UAAM,kCAAwD,CAAC;AAE3D,QAAA,QAAQ,iBAAiB,uBAAuB;AACnD,sCAAgC,KAAK,kBAAkB;AAAA,IAAA,OACjD;AACN,sCAAgC,KAAK,kBAAkB;AAAA,IAAA;AAGjD,WAAA;AAAA,MACN;AAAA,QACC,KAAK;AAAA,QACL,OAAO;AAAA,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AAO;AAAA,cACP,GAAG,qBAAqB;AAAA,YACzB;AAAA,YACA;AAAA,cACC,MAAM,GAAG,SAAS,UAAU,QAAQ,UAAU;AAAA,cAC9C,OAAO;AAAA,cACP,GAAG,qBAAqB;AAAA,YAAA;AAAA,UAE1B;AAAA,UACA;AAAA,YACC,GAAG;AAAA,YACH;AAAA;AAAA,cAEC,OAAO;AAAA,cACP,SAAS,MAAM;AAAA,cASf;AAAA,cACA,GAAG,qBAAqB;AAAA,YACzB;AAAA,YACA;AAAA,cACC,MAAM,GAAG,SAAS,eAAe,QAAQ,UAAU;AAAA,cACnD,OAAO;AAAA,cACP,GAAG,qBAAqB;AAAA,YAAA;AAAA,UACzB;AAAA,QACD;AAAA,MACD;AAAA,IAEF;AAAA,KACE,CAAC,SAAS,aAAa,SAAS,SAAS,CAAC;AAC9C;;"}
|
package/dist/harmony106.mjs
CHANGED
|
@@ -1,17 +1,169 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useNavigationClient } from "./harmony16.mjs";
|
|
3
|
+
import { getProjectNavigationVisibilityMap } from "./harmony127.mjs";
|
|
4
|
+
const useExpertNavigation = (enabled, project, contributor) => {
|
|
5
|
+
const adminRights = (contributor == null ? void 0 : contributor.admin_rights) || [];
|
|
6
|
+
const marketingSupportProjectSelectedAppSlug = "selected-app-slug";
|
|
7
|
+
const navigationClient = useNavigationClient();
|
|
8
|
+
const expertUrl = navigationClient.getExpertUrl();
|
|
9
|
+
return useMemo(() => {
|
|
10
|
+
if (!project || !enabled) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const navigationVisibility = getProjectNavigationVisibilityMap(
|
|
14
|
+
project,
|
|
15
|
+
adminRights,
|
|
16
|
+
() => true
|
|
17
|
+
);
|
|
18
|
+
const appsNavigationItem = {
|
|
19
|
+
key: "apps",
|
|
20
|
+
label: "Apps",
|
|
21
|
+
isActive: (input) => input === "apps",
|
|
22
|
+
link: `${expertUrl}/apps/${project.project_id}/`,
|
|
23
|
+
...navigationVisibility.apps
|
|
24
|
+
};
|
|
25
|
+
const appsNavigationItemArrInMainMenu = [];
|
|
26
|
+
const appsNavigationItemArrInMoreMenu = [];
|
|
27
|
+
if (project.project_type === "content_integration") {
|
|
28
|
+
appsNavigationItemArrInMoreMenu.push(appsNavigationItem);
|
|
29
|
+
} else {
|
|
30
|
+
appsNavigationItemArrInMainMenu.push(appsNavigationItem);
|
|
31
|
+
}
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
key: "edit",
|
|
35
|
+
label: "Editor",
|
|
36
|
+
link: `${expertUrl}/project/${project.project_id}/`,
|
|
37
|
+
isActive: (input) => input === "edit",
|
|
38
|
+
...navigationVisibility.editor
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "files",
|
|
42
|
+
label: "Files",
|
|
43
|
+
link: `${expertUrl}/files/${project.project_id}/`,
|
|
44
|
+
isActive: (input) => input === "files",
|
|
45
|
+
...navigationVisibility.files
|
|
46
|
+
},
|
|
47
|
+
...project.project_type === "content_integration" ? [
|
|
48
|
+
{
|
|
49
|
+
key: "contentManagement",
|
|
50
|
+
label: "Content management",
|
|
51
|
+
isActive: (input) => input === "apps",
|
|
52
|
+
link: `${expertUrl}/apps/${project.project_id}/${marketingSupportProjectSelectedAppSlug}`,
|
|
53
|
+
...navigationVisibility.contentManagement
|
|
54
|
+
}
|
|
55
|
+
] : [
|
|
56
|
+
{
|
|
57
|
+
key: "upload",
|
|
58
|
+
label: "Upload",
|
|
59
|
+
link: `${expertUrl}/upload/${project.project_id}/`,
|
|
60
|
+
isActive: (input) => input === "upload",
|
|
61
|
+
...navigationVisibility.upload
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: "download",
|
|
65
|
+
label: "Download",
|
|
66
|
+
link: `${expertUrl}/download/${project.project_id}/`,
|
|
67
|
+
isActive: (input) => input === "download",
|
|
68
|
+
...navigationVisibility.download
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
{
|
|
72
|
+
key: "tasks",
|
|
73
|
+
label: "Tasks",
|
|
74
|
+
link: `${expertUrl}/tasks/${project.project_id}/`,
|
|
75
|
+
isActive: (input) => input === "tasks",
|
|
76
|
+
// TODO: Add task count
|
|
77
|
+
// badge: taskCount,
|
|
78
|
+
...navigationVisibility.tasks
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: "workflows",
|
|
82
|
+
label: "Workflows",
|
|
83
|
+
link: `${expertUrl}/workflows/${project.project_id}/`,
|
|
84
|
+
isActive: (input) => input === "workflows",
|
|
85
|
+
novel: "New",
|
|
86
|
+
onClick: () => {
|
|
87
|
+
window.location.assign(`${expertUrl}/workflows/${project.project_id}/`);
|
|
88
|
+
},
|
|
89
|
+
...navigationVisibility.workflows
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: "contributors",
|
|
93
|
+
label: "Contributors",
|
|
94
|
+
link: `${expertUrl}/contributors/${project.project_id}/`,
|
|
95
|
+
isActive: (input) => input === "contributors",
|
|
96
|
+
...navigationVisibility.contributors
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: "screenshots",
|
|
100
|
+
label: "Screenshots",
|
|
101
|
+
link: `${expertUrl}/screenshots/${project.project_id}/`,
|
|
102
|
+
isActive: (input) => input === "screenshots",
|
|
103
|
+
...navigationVisibility.screenshots
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "glossary",
|
|
107
|
+
label: "Glossary",
|
|
108
|
+
link: `${expertUrl}/glossary/${project.project_id}/`,
|
|
109
|
+
isActive: (input) => input === "glossary",
|
|
110
|
+
...navigationVisibility.glossary
|
|
111
|
+
},
|
|
112
|
+
...appsNavigationItemArrInMainMenu,
|
|
113
|
+
{
|
|
114
|
+
key: "more",
|
|
115
|
+
label: "More...",
|
|
116
|
+
isActive: (input) => ["settings", "statistics", "duplicates", "live edit"].includes(input),
|
|
117
|
+
...navigationVisibility.more,
|
|
118
|
+
dropdown: [
|
|
119
|
+
[
|
|
120
|
+
{
|
|
121
|
+
link: `${expertUrl}/settings/${project.project_id}/`,
|
|
122
|
+
label: "Settings",
|
|
123
|
+
...navigationVisibility.settings
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
link: `${expertUrl}/settings/${project.project_id}/#branches`,
|
|
127
|
+
label: "Branches",
|
|
128
|
+
...navigationVisibility.branches
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
link: `${expertUrl}/settings/${project.project_id}/#ota-bundles`,
|
|
132
|
+
label: "OTA Bundles",
|
|
133
|
+
...navigationVisibility.otaBundles
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
link: `${expertUrl}/settings/${project.project_id}/#project-automations`,
|
|
137
|
+
label: "Automations",
|
|
138
|
+
...navigationVisibility.automations
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
link: `${expertUrl}/dupes/${project.project_id}/`,
|
|
142
|
+
label: "Duplicate finder",
|
|
143
|
+
...navigationVisibility.duplicateFinder
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
...appsNavigationItemArrInMoreMenu,
|
|
148
|
+
{
|
|
149
|
+
// TODO: This could be problematic tab, because it is not a link and we can't just redirect. We need to find a workaround for that.
|
|
150
|
+
label: "Activity",
|
|
151
|
+
onClick: () => {
|
|
152
|
+
},
|
|
153
|
+
...navigationVisibility.activity
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
link: `${expertUrl}/statistics/${project.project_id}/`,
|
|
157
|
+
label: "Statistics",
|
|
158
|
+
...navigationVisibility.statistics
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
}, [project, adminRights, enabled, expertUrl]);
|
|
11
165
|
};
|
|
12
|
-
__publicField(_NewJwtIssuedEvent, "eventName", "new-jwt-issued");
|
|
13
|
-
let NewJwtIssuedEvent = _NewJwtIssuedEvent;
|
|
14
166
|
export {
|
|
15
|
-
|
|
167
|
+
useExpertNavigation
|
|
16
168
|
};
|
|
17
169
|
//# sourceMappingURL=harmony106.mjs.map
|
package/dist/harmony106.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harmony106.mjs","sources":["../src/features/auth/frontend/events/NewJwtIssuedEvent.ts"],"sourcesContent":["import type { JwtTokenPayload } from '@features/auth/core/types/jwtTokenPayload'\nimport { parseJwtTokenPayload } from '@features/auth/core/utils/jwtTokenPayload'\nimport type { JwtToken } from '@features/publicApi/types/userTokenTypes'\n\ntype NewJwtIssuedEventDetail = {\n\ttoken: JwtToken\n\tpayload: JwtTokenPayload | undefined\n}\n\n/**\n * This event is emitted when a new JWT token is issued or refreshed.\n */\nexport class NewJwtIssuedEvent extends CustomEvent<NewJwtIssuedEventDetail> {\n\tstatic readonly eventName = 'new-jwt-issued' as const\n\n\tconstructor(token: JwtToken) {\n\t\tsuper(NewJwtIssuedEvent.eventName, {\n\t\t\tdetail: { token, payload: parseJwtTokenPayload(token.accessToken) },\n\t\t})\n\t}\n}\n\nexport const isNewJwtIssuedEvent = (event: Event): event is NewJwtIssuedEvent =>\n\tevent.type === NewJwtIssuedEvent.eventName\n\ndeclare global {\n\tinterface WindowEventMap {\n\t\t[NewJwtIssuedEvent.eventName]: NewJwtIssuedEvent\n\t}\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,qBAAN,MAAM,2BAA0B,YAAqC;AAAA,EAG3E,YAAY,OAAiB;AAC5B,UAAM,mBAAkB,WAAW;AAAA,MAClC,QAAQ,EAAE,OAAO,SAAS,qBAAqB,MAAM,WAAW,EAAE;AAAA,IAAA,CAClE;AAAA,EAAA;AAEH;AAPC,cADY,oBACI,aAAY;AADtB,IAAM,oBAAN;"}
|
|
1
|
+
{"version":3,"file":"harmony106.mjs","sources":["../src/features/navigation/hooks/useExpertNavigation.ts"],"sourcesContent":["import type { Contributor, Project } from '@features/node'\nimport { useMemo } from 'react'\nimport { useNavigationClient } from '../providers/NavigationClientProvider'\nimport type { NavigationTabsItem } from '../types/navigation'\nimport { getProjectNavigationVisibilityMap } from '../utils/toolbarVisibility'\n\n// TODO: Validate features types\nexport const getIsFeatureEnabled = (features: Record<string, boolean>, name: string) => {\n\tconst featureState = features[name]\n\n\treturn (\n\t\tfeatureState !== null &&\n\t\tfeatureState !== undefined &&\n\t\t[true, 'on', 'true'].includes(featureState)\n\t)\n}\n\n/**\n * Hook to generate legacy navigation items using the existing structure\n * but with context API instead of Redux\n */\nexport const useExpertNavigation = (\n\tenabled: boolean,\n\tproject?: Project,\n\tcontributor?: Contributor,\n) => {\n\t// Use contributor data if provided, otherwise use defaults\n\tconst adminRights = contributor?.admin_rights || []\n\t// TODO: Implement selected app slug, small investigation is needed\n\tconst marketingSupportProjectSelectedAppSlug = 'selected-app-slug'\n\tconst navigationClient = useNavigationClient()\n\tconst expertUrl = navigationClient.getExpertUrl()\n\n\treturn useMemo(() => {\n\t\t// Get data from contexts instead of Redux, or use provided data\n\t\tif (!project || !enabled) {\n\t\t\treturn []\n\t\t}\n\t\t/* TODO: We're missing badges API. We need to get it from the backend or find alternative way to get task count\n\t\t * Fetch tasks and calculate count is not a good idea, because it can have pagination, therefore we can\n\t\t * ask for an additional prop in tasks response: task_count based on branch_id + project_id + task_status\n\t\t */\n\t\t// const taskCount = getTaskCount(project, branch, badges.tasks)\n\n\t\t// TODO: Implement feature flags functionality, most likely separate package\n\t\t// const isFeatureEnabled = (feature: string) => getIsFeatureEnabled(features, feature)\n\n\t\tconst navigationVisibility = getProjectNavigationVisibilityMap(\n\t\t\tproject,\n\t\t\tadminRights,\n\t\t\t() => true /*isFeatureEnabled*/,\n\t\t)\n\n\t\tconst appsNavigationItem: NavigationTabsItem = {\n\t\t\tkey: 'apps',\n\t\t\tlabel: 'Apps',\n\t\t\tisActive: (input: string) => input === 'apps',\n\t\t\tlink: `${expertUrl}/apps/${project.project_id}/`,\n\t\t\t...navigationVisibility.apps,\n\t\t}\n\n\t\tconst appsNavigationItemArrInMainMenu: NavigationTabsItem[] = []\n\t\tconst appsNavigationItemArrInMoreMenu: NavigationTabsItem[] = []\n\n\t\tif (project.project_type === 'content_integration') {\n\t\t\tappsNavigationItemArrInMoreMenu.push(appsNavigationItem)\n\t\t} else {\n\t\t\tappsNavigationItemArrInMainMenu.push(appsNavigationItem)\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: 'edit',\n\t\t\t\tlabel: 'Editor',\n\t\t\t\tlink: `${expertUrl}/project/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'edit',\n\t\t\t\t...navigationVisibility.editor,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'files',\n\t\t\t\tlabel: 'Files',\n\t\t\t\tlink: `${expertUrl}/files/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'files',\n\t\t\t\t...navigationVisibility.files,\n\t\t\t},\n\t\t\t...(project.project_type === 'content_integration'\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'contentManagement',\n\t\t\t\t\t\t\tlabel: 'Content management',\n\t\t\t\t\t\t\tisActive: (input: string) => input === 'apps',\n\t\t\t\t\t\t\tlink: `${expertUrl}/apps/${project.project_id}/${marketingSupportProjectSelectedAppSlug}`,\n\t\t\t\t\t\t\t...navigationVisibility.contentManagement,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'upload',\n\t\t\t\t\t\t\tlabel: 'Upload',\n\t\t\t\t\t\t\tlink: `${expertUrl}/upload/${project.project_id}/`,\n\t\t\t\t\t\t\tisActive: (input: string) => input === 'upload',\n\t\t\t\t\t\t\t...navigationVisibility.upload,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'download',\n\t\t\t\t\t\t\tlabel: 'Download',\n\t\t\t\t\t\t\tlink: `${expertUrl}/download/${project.project_id}/`,\n\t\t\t\t\t\t\tisActive: (input: string) => input === 'download',\n\t\t\t\t\t\t\t...navigationVisibility.download,\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t{\n\t\t\t\tkey: 'tasks',\n\t\t\t\tlabel: 'Tasks',\n\t\t\t\tlink: `${expertUrl}/tasks/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'tasks',\n\t\t\t\t// TODO: Add task count\n\t\t\t\t// badge: taskCount,\n\t\t\t\t...navigationVisibility.tasks,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'workflows',\n\t\t\t\tlabel: 'Workflows',\n\t\t\t\tlink: `${expertUrl}/workflows/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'workflows',\n\t\t\t\tnovel: 'New',\n\t\t\t\tonClick: () => {\n\t\t\t\t\t// TODO: Resolve analytics globally, most likely separate package\n\t\t\t\t\t// track(AnalyticsEventName.EDITOR_WORKFLOWS_TAB_CLICKED);\n\t\t\t\t\twindow.location.assign(`${expertUrl}/workflows/${project.project_id}/`)\n\t\t\t\t},\n\t\t\t\t...navigationVisibility.workflows,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'contributors',\n\t\t\t\tlabel: 'Contributors',\n\t\t\t\tlink: `${expertUrl}/contributors/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'contributors',\n\t\t\t\t...navigationVisibility.contributors,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'screenshots',\n\t\t\t\tlabel: 'Screenshots',\n\t\t\t\tlink: `${expertUrl}/screenshots/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'screenshots',\n\t\t\t\t...navigationVisibility.screenshots,\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: 'glossary',\n\t\t\t\tlabel: 'Glossary',\n\t\t\t\tlink: `${expertUrl}/glossary/${project.project_id}/`,\n\t\t\t\tisActive: (input: string) => input === 'glossary',\n\t\t\t\t...navigationVisibility.glossary,\n\t\t\t},\n\t\t\t...appsNavigationItemArrInMainMenu,\n\t\t\t{\n\t\t\t\tkey: 'more',\n\t\t\t\tlabel: 'More...',\n\t\t\t\tisActive: (input: string) =>\n\t\t\t\t\t['settings', 'statistics', 'duplicates', 'live edit'].includes(input),\n\t\t\t\t...navigationVisibility.more,\n\t\t\t\tdropdown: [\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/settings/${project.project_id}/`,\n\t\t\t\t\t\t\tlabel: 'Settings',\n\t\t\t\t\t\t\t...navigationVisibility.settings,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/settings/${project.project_id}/#branches`,\n\t\t\t\t\t\t\tlabel: 'Branches',\n\t\t\t\t\t\t\t...navigationVisibility.branches,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/settings/${project.project_id}/#ota-bundles`,\n\t\t\t\t\t\t\tlabel: 'OTA Bundles',\n\t\t\t\t\t\t\t...navigationVisibility.otaBundles,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/settings/${project.project_id}/#project-automations`,\n\t\t\t\t\t\t\tlabel: 'Automations',\n\t\t\t\t\t\t\t...navigationVisibility.automations,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/dupes/${project.project_id}/`,\n\t\t\t\t\t\t\tlabel: 'Duplicate finder',\n\t\t\t\t\t\t\t...navigationVisibility.duplicateFinder,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t[\n\t\t\t\t\t\t...appsNavigationItemArrInMoreMenu,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO: This could be problematic tab, because it is not a link and we can't just redirect. We need to find a workaround for that.\n\t\t\t\t\t\t\tlabel: 'Activity',\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t// const showActivityEvent = new CustomEvent(\"show-activity\", {\n\t\t\t\t\t\t\t\t// \tdetail: {\n\t\t\t\t\t\t\t\t// \t\tprojectId: project.id,\n\t\t\t\t\t\t\t\t// \t\tbranchId: branch.branchId,\n\t\t\t\t\t\t\t\t// \t\tbranchName: branch.branchName,\n\t\t\t\t\t\t\t\t// \t},\n\t\t\t\t\t\t\t\t// });\n\t\t\t\t\t\t\t\t// document.dispatchEvent(showActivityEvent);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...navigationVisibility.activity,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlink: `${expertUrl}/statistics/${project.project_id}/`,\n\t\t\t\t\t\t\tlabel: 'Statistics',\n\t\t\t\t\t\t\t...navigationVisibility.statistics,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t},\n\t\t]\n\t}, [project, adminRights, enabled, expertUrl])\n}\n\n// TODO: Helper function for getting task count from badge data\n// const _getTaskCount = (project: any, branch: any, taskBadges: any) => {\n// \tif (!taskBadges) return 0\n\n// \t// Implementation would depend on your getTaskCountFromTasks utility\n// \t// Simplified version:\n// \tconst projectTasks = taskBadges[project.id] || {}\n// \treturn projectTasks[branch.branchId || 'master'] || 0\n// }\n"],"names":[],"mappings":";;;AAqBO,MAAM,sBAAsB,CAClC,SACA,SACA,gBACI;AAEE,QAAA,eAAc,2CAAa,iBAAgB,CAAC;AAElD,QAAM,yCAAyC;AAC/C,QAAM,mBAAmB,oBAAoB;AACvC,QAAA,YAAY,iBAAiB,aAAa;AAEhD,SAAO,QAAQ,MAAM;AAEhB,QAAA,CAAC,WAAW,CAAC,SAAS;AACzB,aAAO,CAAC;AAAA,IAAA;AAWT,UAAM,uBAAuB;AAAA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