@lokalise/harmony 1.40.1 → 1.40.2

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 (93) hide show
  1. package/dist/harmony115.cjs +96 -84
  2. package/dist/harmony115.cjs.map +1 -1
  3. package/dist/harmony115.mjs +79 -84
  4. package/dist/harmony115.mjs.map +1 -1
  5. package/dist/harmony116.cjs +87 -30
  6. package/dist/harmony116.cjs.map +1 -1
  7. package/dist/harmony116.mjs +87 -30
  8. package/dist/harmony116.mjs.map +1 -1
  9. package/dist/harmony117.cjs +29 -98
  10. package/dist/harmony117.cjs.map +1 -1
  11. package/dist/harmony117.mjs +29 -81
  12. package/dist/harmony117.mjs.map +1 -1
  13. package/dist/harmony127.cjs +6 -11
  14. package/dist/harmony127.cjs.map +1 -1
  15. package/dist/harmony127.mjs +5 -10
  16. package/dist/harmony127.mjs.map +1 -1
  17. package/dist/harmony128.cjs +4 -4
  18. package/dist/harmony128.mjs +4 -4
  19. package/dist/harmony129.cjs +11 -6
  20. package/dist/harmony129.cjs.map +1 -1
  21. package/dist/harmony129.mjs +10 -5
  22. package/dist/harmony129.mjs.map +1 -1
  23. package/dist/harmony131.cjs +4 -4
  24. package/dist/harmony131.mjs +4 -4
  25. package/dist/harmony135.cjs +1 -1
  26. package/dist/harmony135.mjs +1 -1
  27. package/dist/harmony136.cjs +2 -2
  28. package/dist/harmony136.mjs +2 -2
  29. package/dist/harmony138.cjs +13 -7
  30. package/dist/harmony138.cjs.map +1 -1
  31. package/dist/harmony138.mjs +13 -7
  32. package/dist/harmony138.mjs.map +1 -1
  33. package/dist/harmony139.cjs +15 -57
  34. package/dist/harmony139.cjs.map +1 -1
  35. package/dist/harmony139.mjs +15 -57
  36. package/dist/harmony139.mjs.map +1 -1
  37. package/dist/harmony140.cjs +15 -59
  38. package/dist/harmony140.cjs.map +1 -1
  39. package/dist/harmony140.mjs +15 -59
  40. package/dist/harmony140.mjs.map +1 -1
  41. package/dist/harmony141.cjs +7 -18
  42. package/dist/harmony141.cjs.map +1 -1
  43. package/dist/harmony141.mjs +6 -17
  44. package/dist/harmony141.mjs.map +1 -1
  45. package/dist/harmony142.cjs +57 -13
  46. package/dist/harmony142.cjs.map +1 -1
  47. package/dist/harmony142.mjs +57 -13
  48. package/dist/harmony142.mjs.map +1 -1
  49. package/dist/harmony143.cjs +59 -14
  50. package/dist/harmony143.cjs.map +1 -1
  51. package/dist/harmony143.mjs +59 -14
  52. package/dist/harmony143.mjs.map +1 -1
  53. package/dist/harmony144.cjs +19 -17
  54. package/dist/harmony144.cjs.map +1 -1
  55. package/dist/harmony144.mjs +18 -16
  56. package/dist/harmony144.mjs.map +1 -1
  57. package/dist/harmony150.cjs +1 -1
  58. package/dist/harmony150.mjs +1 -1
  59. package/dist/harmony66.cjs +1 -0
  60. package/dist/harmony66.cjs.map +1 -1
  61. package/dist/harmony66.mjs +1 -0
  62. package/dist/harmony66.mjs.map +1 -1
  63. package/dist/harmony75.cjs +1 -1
  64. package/dist/harmony75.mjs +1 -1
  65. package/dist/harmony88.cjs +2 -2
  66. package/dist/harmony88.mjs +2 -2
  67. package/dist/harmony92.cjs +2 -2
  68. package/dist/harmony92.mjs +2 -2
  69. package/dist/harmony96.cjs +11 -166
  70. package/dist/harmony96.cjs.map +1 -1
  71. package/dist/harmony96.mjs +11 -166
  72. package/dist/harmony96.mjs.map +1 -1
  73. package/dist/harmony97.cjs +21 -44
  74. package/dist/harmony97.cjs.map +1 -1
  75. package/dist/harmony97.mjs +20 -43
  76. package/dist/harmony97.mjs.map +1 -1
  77. package/dist/harmony98.cjs +166 -11
  78. package/dist/harmony98.cjs.map +1 -1
  79. package/dist/harmony98.mjs +166 -11
  80. package/dist/harmony98.mjs.map +1 -1
  81. package/dist/harmony99.cjs +44 -21
  82. package/dist/harmony99.cjs.map +1 -1
  83. package/dist/harmony99.mjs +43 -20
  84. package/dist/harmony99.mjs.map +1 -1
  85. package/dist/types/src/features/navigation/hooks/useNavigation.d.ts +1 -1
  86. package/dist/types/src/features/navigation/hooks/useNavigationQueries.d.ts +3 -3
  87. package/dist/types/src/features/publicApi/hooks/useCreateProjectMutation.d.ts +2 -2
  88. package/dist/types/src/features/publicApi/hooks/useListProjectsQuery.d.ts +2 -2
  89. package/dist/types/src/features/publicApi/hooks/useRetrieveProjectQuery.d.ts +1 -1
  90. package/dist/types/src/features/publicApi/hooks/useUpdateProjectMutation.d.ts +1 -1
  91. package/dist/types/src/features/publicApi/projects.d.ts +20 -20
  92. package/dist/types/src/features/publicApi/types/projectTypes.d.ts +15 -15
  93. package/package.json +1 -1
@@ -1,90 +1,102 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const permissions = require("./harmony127.cjs");
4
- const getProjectNavigationVisibilityMap = (project, adminRights, isFeatureEnabled) => {
5
- var _a, _b;
6
- return {
7
- upload: {
8
- visible: permissions.hasAdminRight(adminRights, "upload"),
9
- disabled: false
10
- },
11
- download: {
12
- visible: permissions.hasAdminRight(adminRights, "download"),
13
- disabled: false
14
- },
15
- // TODO: HOME-1009, Clean up after permission management
16
- // -- There is a plan for "Install apps" permission. Right..?
17
- apps: {
18
- visible: true,
19
- disabled: false
20
- },
21
- // TODO: HOME-1009, Clean up after permission management
22
- // -- There is a plan for "Install apps" permission. Right..?
23
- contentManagement: {
24
- visible: project.project_type === "content_integration" && permissions.hasAdminRight(adminRights, "keys"),
25
- disabled: false
26
- },
27
- editor: {
28
- visible: true,
29
- disabled: false
30
- },
31
- files: {
32
- visible: isFeatureEnabled("lionLfcFilesManagement") && project.project_type === "paged_documents" && permissions.hasAnyAdminRight(adminRights, ["upload", "download"]),
33
- disabled: false
34
- },
35
- tasks: {
36
- visible: permissions.hasAdminRight(adminRights, "tasks"),
37
- disabled: false
38
- },
39
- contributors: {
40
- visible: permissions.hasAdminRight(adminRights, "contributors"),
41
- disabled: false
42
- },
43
- workflows: {
44
- visible: permissions.hasAdminRight(adminRights, "settings"),
45
- disabled: false
46
- },
47
- screenshots: {
48
- visible: permissions.hasAdminRight(adminRights, "screenshots"),
49
- disabled: false
50
- },
51
- glossary: {
52
- visible: permissions.hasAdminRight(adminRights, "glossary"),
53
- disabled: false
54
- },
55
- more: {
56
- visible: true,
57
- disabled: false
58
- },
59
- settings: {
60
- visible: permissions.hasAdminRight(adminRights, "settings"),
61
- disabled: false
62
- },
63
- branches: {
64
- visible: !!((_a = project.settings) == null ? void 0 : _a.branching) && permissions.hasAnyAdminRight(adminRights, ["branches_create", "create_branches", "branches_merge"]),
65
- disabled: false
66
- },
67
- otaBundles: {
68
- visible: permissions.hasAnyAdminRight(adminRights, ["download", "settings", "keys"]) && project.project_type === "localization_files",
69
- disabled: false
70
- },
71
- automations: {
72
- visible: permissions.hasAdminRight(adminRights, "settings"),
73
- disabled: false
74
- },
75
- duplicateFinder: {
76
- visible: permissions.hasAdminRight(adminRights, "keys") && project.project_type === "localization_files",
77
- disabled: false
78
- },
79
- activity: {
80
- visible: !!((_b = project.settings) == null ? void 0 : _b.offline_translation) || permissions.hasAdminRight(adminRights, "activity"),
81
- disabled: false
82
- },
83
- statistics: {
84
- visible: permissions.hasAdminRight(adminRights, "statistics"),
85
- disabled: false
3
+ const React = require("react");
4
+ const debounce = require("./harmony127.cjs");
5
+ const throttle = require("./harmony128.cjs");
6
+ function _interopNamespaceDefault(e) {
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
23
+ const patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {
24
+ switch (refreshMode) {
25
+ case "debounce":
26
+ return debounce.default(resizeCallback, refreshRate, refreshOptions);
27
+ case "throttle":
28
+ return throttle.default(resizeCallback, refreshRate, refreshOptions);
29
+ default:
30
+ return resizeCallback;
31
+ }
32
+ };
33
+ const useCallbackRef = (
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ (callback) => {
36
+ const callbackRef = React__namespace.useRef(callback);
37
+ React__namespace.useEffect(() => {
38
+ callbackRef.current = callback;
39
+ });
40
+ return React__namespace.useMemo(() => (...args) => {
41
+ var _a;
42
+ return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args);
43
+ }, []);
44
+ }
45
+ );
46
+ const useRefProxy = (
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ (targetRef) => {
49
+ const [refElement, setRefElement] = React__namespace.useState((targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) || null);
50
+ if (targetRef) {
51
+ setTimeout(() => {
52
+ if (targetRef.current !== refElement) {
53
+ setRefElement(targetRef.current);
54
+ }
55
+ }, 0);
86
56
  }
57
+ const refProxy = React__namespace.useMemo(() => new Proxy((node) => {
58
+ if (node !== refElement) {
59
+ setRefElement(node);
60
+ }
61
+ }, {
62
+ get(target, prop) {
63
+ if (prop === "current") {
64
+ return refElement;
65
+ }
66
+ return target[prop];
67
+ },
68
+ set(target, prop, value) {
69
+ if (prop === "current") {
70
+ setRefElement(value);
71
+ } else {
72
+ target[prop] = value;
73
+ }
74
+ return true;
75
+ }
76
+ }), [refElement]);
77
+ return { refProxy, refElement, setRefElement };
78
+ }
79
+ );
80
+ const getDimensions = (entry, box) => {
81
+ if (box === "border-box") {
82
+ return {
83
+ width: entry.borderBoxSize[0].inlineSize,
84
+ height: entry.borderBoxSize[0].blockSize
85
+ };
86
+ }
87
+ if (box === "content-box") {
88
+ return {
89
+ width: entry.contentBoxSize[0].inlineSize,
90
+ height: entry.contentBoxSize[0].blockSize
91
+ };
92
+ }
93
+ return {
94
+ width: entry.contentRect.width,
95
+ height: entry.contentRect.height
87
96
  };
88
97
  };
89
- exports.getProjectNavigationVisibilityMap = getProjectNavigationVisibilityMap;
98
+ exports.getDimensions = getDimensions;
99
+ exports.patchResizeCallback = patchResizeCallback;
100
+ exports.useCallbackRef = useCallbackRef;
101
+ exports.useRefProxy = useRefProxy;
90
102
  //# sourceMappingURL=harmony115.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony115.cjs","sources":["../src/features/navigation/utils/toolbarVisibility.ts"],"sourcesContent":["import { hasAdminRight, hasAnyAdminRight } from '@features/auth/utils/permissions'\nimport type { Project } from '@features/node'\n\ntype ToolbarVisibility = {\n\tdisabled: boolean\n\tvisible: boolean\n}\n\nexport type ToolbarVisibilityMap = {\n\tupload: ToolbarVisibility\n\tdownload: ToolbarVisibility\n\tapps: ToolbarVisibility\n\tcontentManagement: ToolbarVisibility\n\teditor: ToolbarVisibility\n\tfiles: ToolbarVisibility\n\ttasks: ToolbarVisibility\n\tworkflows: ToolbarVisibility\n\tcontributors: ToolbarVisibility\n\tscreenshots: ToolbarVisibility\n\tglossary: ToolbarVisibility\n\tmore: ToolbarVisibility\n\tsettings: ToolbarVisibility\n\tbranches: ToolbarVisibility\n\totaBundles: ToolbarVisibility\n\tautomations: ToolbarVisibility\n\tduplicateFinder: ToolbarVisibility\n\tactivity: ToolbarVisibility\n\tstatistics: ToolbarVisibility\n}\n\nexport const getProjectNavigationVisibilityMap = (\n\tproject: Project,\n\tadminRights: string[],\n\tisFeatureEnabled: (key: string) => boolean,\n): ToolbarVisibilityMap => ({\n\tupload: {\n\t\tvisible: hasAdminRight(adminRights, 'upload'),\n\t\tdisabled: false,\n\t},\n\tdownload: {\n\t\tvisible: hasAdminRight(adminRights, 'download'),\n\t\tdisabled: false,\n\t},\n\t// TODO: HOME-1009, Clean up after permission management\n\t// -- There is a plan for \"Install apps\" permission. Right..?\n\tapps: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\t// TODO: HOME-1009, Clean up after permission management\n\t// -- There is a plan for \"Install apps\" permission. Right..?\n\tcontentManagement: {\n\t\tvisible: project.project_type === 'content_integration' && hasAdminRight(adminRights, 'keys'),\n\t\tdisabled: false,\n\t},\n\teditor: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\tfiles: {\n\t\tvisible:\n\t\t\tisFeatureEnabled('lionLfcFilesManagement') &&\n\t\t\tproject.project_type === 'paged_documents' &&\n\t\t\thasAnyAdminRight(adminRights, ['upload', 'download']),\n\t\tdisabled: false,\n\t},\n\ttasks: {\n\t\tvisible: hasAdminRight(adminRights, 'tasks'),\n\t\tdisabled: false,\n\t},\n\tcontributors: {\n\t\tvisible: hasAdminRight(adminRights, 'contributors'),\n\t\tdisabled: false,\n\t},\n\tworkflows: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tscreenshots: {\n\t\tvisible: hasAdminRight(adminRights, 'screenshots'),\n\t\tdisabled: false,\n\t},\n\tglossary: {\n\t\tvisible: hasAdminRight(adminRights, 'glossary'),\n\t\tdisabled: false,\n\t},\n\tmore: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\tsettings: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tbranches: {\n\t\tvisible:\n\t\t\t!!project.settings?.branching &&\n\t\t\thasAnyAdminRight(adminRights, ['branches_create', 'create_branches', 'branches_merge']),\n\t\tdisabled: false,\n\t},\n\totaBundles: {\n\t\tvisible:\n\t\t\thasAnyAdminRight(adminRights, ['download', 'settings', 'keys']) &&\n\t\t\tproject.project_type === 'localization_files',\n\t\tdisabled: false,\n\t},\n\tautomations: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tduplicateFinder: {\n\t\tvisible: hasAdminRight(adminRights, 'keys') && project.project_type === 'localization_files',\n\t\tdisabled: false,\n\t},\n\tactivity: {\n\t\tvisible: !!project.settings?.offline_translation || hasAdminRight(adminRights, 'activity'),\n\t\tdisabled: false,\n\t},\n\tstatistics: {\n\t\tvisible: hasAdminRight(adminRights, 'statistics'),\n\t\tdisabled: false,\n\t},\n})\n"],"names":["hasAdminRight","hasAnyAdminRight"],"mappings":";;;AA8BO,MAAM,oCAAoC,CAChD,SACA,aACA,qBAC2B;;AAAA;AAAA,IAC3B,QAAQ;AAAA,MACP,SAASA,YAAAA,cAAc,aAAa,QAAQ;AAAA,MAC5C,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAASA,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA;AAAA;AAAA,IAGA,MAAM;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA;AAAA;AAAA,IAGA,mBAAmB;AAAA,MAClB,SAAS,QAAQ,iBAAiB,yBAAyBA,YAAA,cAAc,aAAa,MAAM;AAAA,MAC5F,UAAU;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,MACP,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,IACA,OAAO;AAAA,MACN,SACC,iBAAiB,wBAAwB,KACzC,QAAQ,iBAAiB,qBACzBC,YAAAA,iBAAiB,aAAa,CAAC,UAAU,UAAU,CAAC;AAAA,MACrD,UAAU;AAAA,IACX;AAAA,IACA,OAAO;AAAA,MACN,SAASD,YAAAA,cAAc,aAAa,OAAO;AAAA,MAC3C,UAAU;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACb,SAASA,YAAAA,cAAc,aAAa,cAAc;AAAA,MAClD,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACV,SAASA,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACZ,SAASA,YAAAA,cAAc,aAAa,aAAa;AAAA,MACjD,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAASA,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAASA,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SACC,CAAC,GAAC,aAAQ,aAAR,mBAAkB,cACpBC,6BAAiB,aAAa,CAAC,mBAAmB,mBAAmB,gBAAgB,CAAC;AAAA,MACvF,UAAU;AAAA,IACX;AAAA,IACA,YAAY;AAAA,MACX,SACCA,YAAAA,iBAAiB,aAAa,CAAC,YAAY,YAAY,MAAM,CAAC,KAC9D,QAAQ,iBAAiB;AAAA,MAC1B,UAAU;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACZ,SAASD,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,iBAAiB;AAAA,MAChB,SAASA,YAAc,cAAA,aAAa,MAAM,KAAK,QAAQ,iBAAiB;AAAA,MACxE,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAAS,CAAC,GAAC,aAAQ,aAAR,mBAAkB,wBAAuBA,YAAA,cAAc,aAAa,UAAU;AAAA,MACzF,UAAU;AAAA,IACX;AAAA,IACA,YAAY;AAAA,MACX,SAASA,YAAAA,cAAc,aAAa,YAAY;AAAA,MAChD,UAAU;AAAA,IAAA;AAAA,EAEZ;AAAA;;"}
1
+ {"version":3,"file":"harmony115.cjs","sources":["../node_modules/react-resize-detector/build/utils.js"],"sourcesContent":["import * as React from 'react';\nimport debounce from 'lodash/debounce.js';\nimport throttle from 'lodash/throttle.js';\n\n/**\n * Wraps the resize callback with a lodash debounce / throttle based on the refresh mode\n */\nconst patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {\n switch (refreshMode) {\n case 'debounce':\n return debounce(resizeCallback, refreshRate, refreshOptions);\n case 'throttle':\n return throttle(resizeCallback, refreshRate, refreshOptions);\n default:\n return resizeCallback;\n }\n};\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nconst useCallbackRef = \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(callback) => {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => ((...args) => { var _a; return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args); }), []);\n};\n/** `useRef` hook doesn't handle conditional rendering or dynamic ref changes.\n * This hook creates a proxy that ensures that `refElement` is updated whenever the ref is changed. */\nconst useRefProxy = \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(targetRef) => {\n // we are going to use this ref to store the last element that was passed to the hook\n const [refElement, setRefElement] = React.useState((targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) || null);\n // if targetRef is passed, we need to update the refElement\n // we have to use setTimeout because ref get assigned after the hook is called\n // in the future releases we are going to remove targetRef and force users to use ref returned by the hook\n if (targetRef) {\n setTimeout(() => {\n if (targetRef.current !== refElement) {\n setRefElement(targetRef.current);\n }\n }, 0);\n }\n // this is a memo that will be called every time the ref is changed\n // This proxy will properly call setState either when the ref is called as a function or when `.current` is set\n // we call setState inside to trigger rerender\n const refProxy = React.useMemo(() => new Proxy((node) => {\n if (node !== refElement) {\n setRefElement(node);\n }\n }, {\n get(target, prop) {\n if (prop === 'current') {\n return refElement;\n }\n return target[prop];\n },\n set(target, prop, value) {\n if (prop === 'current') {\n setRefElement(value);\n }\n else {\n target[prop] = value;\n }\n return true;\n },\n }), [refElement]);\n return { refProxy, refElement, setRefElement };\n};\n/** Calculates the dimensions of the element based on the current box model.\n * @see https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model\n */\nconst getDimensions = (entry, box) => {\n // Value\t Border\t Padding\t Inner Content\n // ---------------------------------------------------\n // 'border-box'\t Yes\t Yes\t Yes\n // 'content-box'\t No\t No\t Yes\n // undefined No\t No?\t Yes\n if (box === 'border-box') {\n return {\n width: entry.borderBoxSize[0].inlineSize,\n height: entry.borderBoxSize[0].blockSize,\n };\n }\n if (box === 'content-box') {\n return {\n width: entry.contentBoxSize[0].inlineSize,\n height: entry.contentBoxSize[0].blockSize,\n };\n }\n return {\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n };\n};\n\nexport { getDimensions, patchResizeCallback, useCallbackRef, useRefProxy };\n//# sourceMappingURL=utils.js.map\n"],"names":["debounce","throttle","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAOK,MAAC,sBAAsB,CAAC,gBAAgB,aAAa,aAAa,mBAAmB;AACtF,UAAQ,aAAW;AAAA,IACf,KAAK;AACD,aAAOA,iBAAS,gBAAgB,aAAa,cAAc;AAAA,IAC/D,KAAK;AACD,aAAOC,iBAAS,gBAAgB,aAAa,cAAc;AAAA,IAC/D;AACI,aAAO;AAAA,EACnB;AACA;AAKK,MAAC;AAAA;AAAA,EAEN,CAAC,aAAa;AACV,UAAM,cAAcC,iBAAM,OAAO,QAAQ;AACzCA,qBAAM,UAAU,MAAM;AAClB,kBAAY,UAAU;AAAA,IAC9B,CAAK;AACD,WAAOA,iBAAM,QAAQ,MAAO,IAAI,SAAS;AAAE,UAAI;AAAI,cAAQ,KAAK,YAAY,aAAa,QAAQ,OAAO,SAAS,SAAS,GAAG,KAAK,aAAa,GAAG,IAAI;AAAA,IAAI,GAAG,CAAA,CAAE;AAAA,EACnK;AAAA;AAGK,MAAC;AAAA;AAAA,EAEN,CAAC,cAAc;AAEX,UAAM,CAAC,YAAY,aAAa,IAAIA,iBAAM,UAAU,cAAc,QAAQ,cAAc,SAAS,SAAS,UAAU,YAAY,IAAI;AAIpI,QAAI,WAAW;AACX,iBAAW,MAAM;AACb,YAAI,UAAU,YAAY,YAAY;AAClC,wBAAc,UAAU,OAAO;AAAA,QAC/C;AAAA,MACS,GAAE,CAAC;AAAA,IACZ;AAII,UAAM,WAAWA,iBAAM,QAAQ,MAAM,IAAI,MAAM,CAAC,SAAS;AACrD,UAAI,SAAS,YAAY;AACrB,sBAAc,IAAI;AAAA,MAC9B;AAAA,IACA,GAAO;AAAA,MACC,IAAI,QAAQ,MAAM;AACd,YAAI,SAAS,WAAW;AACpB,iBAAO;AAAA,QACvB;AACY,eAAO,OAAO,IAAI;AAAA,MACrB;AAAA,MACD,IAAI,QAAQ,MAAM,OAAO;AACrB,YAAI,SAAS,WAAW;AACpB,wBAAc,KAAK;AAAA,QACnC,OACiB;AACD,iBAAO,IAAI,IAAI;AAAA,QAC/B;AACY,eAAO;AAAA,MACV;AAAA,IACT,CAAK,GAAG,CAAC,UAAU,CAAC;AAChB,WAAO,EAAE,UAAU,YAAY,cAAe;AAAA,EAClD;AAAA;AAIK,MAAC,gBAAgB,CAAC,OAAO,QAAQ;AAMlC,MAAI,QAAQ,cAAc;AACtB,WAAO;AAAA,MACH,OAAO,MAAM,cAAc,CAAC,EAAE;AAAA,MAC9B,QAAQ,MAAM,cAAc,CAAC,EAAE;AAAA,IAClC;AAAA,EACT;AACI,MAAI,QAAQ,eAAe;AACvB,WAAO;AAAA,MACH,OAAO,MAAM,eAAe,CAAC,EAAE;AAAA,MAC/B,QAAQ,MAAM,eAAe,CAAC,EAAE;AAAA,IACnC;AAAA,EACT;AACI,SAAO;AAAA,IACH,OAAO,MAAM,YAAY;AAAA,IACzB,QAAQ,MAAM,YAAY;AAAA,EAC7B;AACL;;;;;","x_google_ignoreList":[0]}
@@ -1,90 +1,85 @@
1
- import { hasAdminRight, hasAnyAdminRight } from "./harmony127.mjs";
2
- const getProjectNavigationVisibilityMap = (project, adminRights, isFeatureEnabled) => {
3
- var _a, _b;
4
- return {
5
- upload: {
6
- visible: hasAdminRight(adminRights, "upload"),
7
- disabled: false
8
- },
9
- download: {
10
- visible: hasAdminRight(adminRights, "download"),
11
- disabled: false
12
- },
13
- // TODO: HOME-1009, Clean up after permission management
14
- // -- There is a plan for "Install apps" permission. Right..?
15
- apps: {
16
- visible: true,
17
- disabled: false
18
- },
19
- // TODO: HOME-1009, Clean up after permission management
20
- // -- There is a plan for "Install apps" permission. Right..?
21
- contentManagement: {
22
- visible: project.project_type === "content_integration" && hasAdminRight(adminRights, "keys"),
23
- disabled: false
24
- },
25
- editor: {
26
- visible: true,
27
- disabled: false
28
- },
29
- files: {
30
- visible: isFeatureEnabled("lionLfcFilesManagement") && project.project_type === "paged_documents" && hasAnyAdminRight(adminRights, ["upload", "download"]),
31
- disabled: false
32
- },
33
- tasks: {
34
- visible: hasAdminRight(adminRights, "tasks"),
35
- disabled: false
36
- },
37
- contributors: {
38
- visible: hasAdminRight(adminRights, "contributors"),
39
- disabled: false
40
- },
41
- workflows: {
42
- visible: hasAdminRight(adminRights, "settings"),
43
- disabled: false
44
- },
45
- screenshots: {
46
- visible: hasAdminRight(adminRights, "screenshots"),
47
- disabled: false
48
- },
49
- glossary: {
50
- visible: hasAdminRight(adminRights, "glossary"),
51
- disabled: false
52
- },
53
- more: {
54
- visible: true,
55
- disabled: false
56
- },
57
- settings: {
58
- visible: hasAdminRight(adminRights, "settings"),
59
- disabled: false
60
- },
61
- branches: {
62
- visible: !!((_a = project.settings) == null ? void 0 : _a.branching) && hasAnyAdminRight(adminRights, ["branches_create", "create_branches", "branches_merge"]),
63
- disabled: false
64
- },
65
- otaBundles: {
66
- visible: hasAnyAdminRight(adminRights, ["download", "settings", "keys"]) && project.project_type === "localization_files",
67
- disabled: false
68
- },
69
- automations: {
70
- visible: hasAdminRight(adminRights, "settings"),
71
- disabled: false
72
- },
73
- duplicateFinder: {
74
- visible: hasAdminRight(adminRights, "keys") && project.project_type === "localization_files",
75
- disabled: false
76
- },
77
- activity: {
78
- visible: !!((_b = project.settings) == null ? void 0 : _b.offline_translation) || hasAdminRight(adminRights, "activity"),
79
- disabled: false
80
- },
81
- statistics: {
82
- visible: hasAdminRight(adminRights, "statistics"),
83
- disabled: false
1
+ import * as React from "react";
2
+ import debounce from "./harmony127.mjs";
3
+ import throttle from "./harmony128.mjs";
4
+ const patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {
5
+ switch (refreshMode) {
6
+ case "debounce":
7
+ return debounce(resizeCallback, refreshRate, refreshOptions);
8
+ case "throttle":
9
+ return throttle(resizeCallback, refreshRate, refreshOptions);
10
+ default:
11
+ return resizeCallback;
12
+ }
13
+ };
14
+ const useCallbackRef = (
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ (callback) => {
17
+ const callbackRef = React.useRef(callback);
18
+ React.useEffect(() => {
19
+ callbackRef.current = callback;
20
+ });
21
+ return React.useMemo(() => (...args) => {
22
+ var _a;
23
+ return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args);
24
+ }, []);
25
+ }
26
+ );
27
+ const useRefProxy = (
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ (targetRef) => {
30
+ const [refElement, setRefElement] = React.useState((targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) || null);
31
+ if (targetRef) {
32
+ setTimeout(() => {
33
+ if (targetRef.current !== refElement) {
34
+ setRefElement(targetRef.current);
35
+ }
36
+ }, 0);
84
37
  }
38
+ const refProxy = React.useMemo(() => new Proxy((node) => {
39
+ if (node !== refElement) {
40
+ setRefElement(node);
41
+ }
42
+ }, {
43
+ get(target, prop) {
44
+ if (prop === "current") {
45
+ return refElement;
46
+ }
47
+ return target[prop];
48
+ },
49
+ set(target, prop, value) {
50
+ if (prop === "current") {
51
+ setRefElement(value);
52
+ } else {
53
+ target[prop] = value;
54
+ }
55
+ return true;
56
+ }
57
+ }), [refElement]);
58
+ return { refProxy, refElement, setRefElement };
59
+ }
60
+ );
61
+ const getDimensions = (entry, box) => {
62
+ if (box === "border-box") {
63
+ return {
64
+ width: entry.borderBoxSize[0].inlineSize,
65
+ height: entry.borderBoxSize[0].blockSize
66
+ };
67
+ }
68
+ if (box === "content-box") {
69
+ return {
70
+ width: entry.contentBoxSize[0].inlineSize,
71
+ height: entry.contentBoxSize[0].blockSize
72
+ };
73
+ }
74
+ return {
75
+ width: entry.contentRect.width,
76
+ height: entry.contentRect.height
85
77
  };
86
78
  };
87
79
  export {
88
- getProjectNavigationVisibilityMap
80
+ getDimensions,
81
+ patchResizeCallback,
82
+ useCallbackRef,
83
+ useRefProxy
89
84
  };
90
85
  //# sourceMappingURL=harmony115.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony115.mjs","sources":["../src/features/navigation/utils/toolbarVisibility.ts"],"sourcesContent":["import { hasAdminRight, hasAnyAdminRight } from '@features/auth/utils/permissions'\nimport type { Project } from '@features/node'\n\ntype ToolbarVisibility = {\n\tdisabled: boolean\n\tvisible: boolean\n}\n\nexport type ToolbarVisibilityMap = {\n\tupload: ToolbarVisibility\n\tdownload: ToolbarVisibility\n\tapps: ToolbarVisibility\n\tcontentManagement: ToolbarVisibility\n\teditor: ToolbarVisibility\n\tfiles: ToolbarVisibility\n\ttasks: ToolbarVisibility\n\tworkflows: ToolbarVisibility\n\tcontributors: ToolbarVisibility\n\tscreenshots: ToolbarVisibility\n\tglossary: ToolbarVisibility\n\tmore: ToolbarVisibility\n\tsettings: ToolbarVisibility\n\tbranches: ToolbarVisibility\n\totaBundles: ToolbarVisibility\n\tautomations: ToolbarVisibility\n\tduplicateFinder: ToolbarVisibility\n\tactivity: ToolbarVisibility\n\tstatistics: ToolbarVisibility\n}\n\nexport const getProjectNavigationVisibilityMap = (\n\tproject: Project,\n\tadminRights: string[],\n\tisFeatureEnabled: (key: string) => boolean,\n): ToolbarVisibilityMap => ({\n\tupload: {\n\t\tvisible: hasAdminRight(adminRights, 'upload'),\n\t\tdisabled: false,\n\t},\n\tdownload: {\n\t\tvisible: hasAdminRight(adminRights, 'download'),\n\t\tdisabled: false,\n\t},\n\t// TODO: HOME-1009, Clean up after permission management\n\t// -- There is a plan for \"Install apps\" permission. Right..?\n\tapps: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\t// TODO: HOME-1009, Clean up after permission management\n\t// -- There is a plan for \"Install apps\" permission. Right..?\n\tcontentManagement: {\n\t\tvisible: project.project_type === 'content_integration' && hasAdminRight(adminRights, 'keys'),\n\t\tdisabled: false,\n\t},\n\teditor: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\tfiles: {\n\t\tvisible:\n\t\t\tisFeatureEnabled('lionLfcFilesManagement') &&\n\t\t\tproject.project_type === 'paged_documents' &&\n\t\t\thasAnyAdminRight(adminRights, ['upload', 'download']),\n\t\tdisabled: false,\n\t},\n\ttasks: {\n\t\tvisible: hasAdminRight(adminRights, 'tasks'),\n\t\tdisabled: false,\n\t},\n\tcontributors: {\n\t\tvisible: hasAdminRight(adminRights, 'contributors'),\n\t\tdisabled: false,\n\t},\n\tworkflows: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tscreenshots: {\n\t\tvisible: hasAdminRight(adminRights, 'screenshots'),\n\t\tdisabled: false,\n\t},\n\tglossary: {\n\t\tvisible: hasAdminRight(adminRights, 'glossary'),\n\t\tdisabled: false,\n\t},\n\tmore: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\tsettings: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tbranches: {\n\t\tvisible:\n\t\t\t!!project.settings?.branching &&\n\t\t\thasAnyAdminRight(adminRights, ['branches_create', 'create_branches', 'branches_merge']),\n\t\tdisabled: false,\n\t},\n\totaBundles: {\n\t\tvisible:\n\t\t\thasAnyAdminRight(adminRights, ['download', 'settings', 'keys']) &&\n\t\t\tproject.project_type === 'localization_files',\n\t\tdisabled: false,\n\t},\n\tautomations: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tduplicateFinder: {\n\t\tvisible: hasAdminRight(adminRights, 'keys') && project.project_type === 'localization_files',\n\t\tdisabled: false,\n\t},\n\tactivity: {\n\t\tvisible: !!project.settings?.offline_translation || hasAdminRight(adminRights, 'activity'),\n\t\tdisabled: false,\n\t},\n\tstatistics: {\n\t\tvisible: hasAdminRight(adminRights, 'statistics'),\n\t\tdisabled: false,\n\t},\n})\n"],"names":[],"mappings":";AA8BO,MAAM,oCAAoC,CAChD,SACA,aACA,qBAC2B;;AAAA;AAAA,IAC3B,QAAQ;AAAA,MACP,SAAS,cAAc,aAAa,QAAQ;AAAA,MAC5C,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAAS,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA;AAAA;AAAA,IAGA,MAAM;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA;AAAA;AAAA,IAGA,mBAAmB;AAAA,MAClB,SAAS,QAAQ,iBAAiB,yBAAyB,cAAc,aAAa,MAAM;AAAA,MAC5F,UAAU;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,MACP,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,IACA,OAAO;AAAA,MACN,SACC,iBAAiB,wBAAwB,KACzC,QAAQ,iBAAiB,qBACzB,iBAAiB,aAAa,CAAC,UAAU,UAAU,CAAC;AAAA,MACrD,UAAU;AAAA,IACX;AAAA,IACA,OAAO;AAAA,MACN,SAAS,cAAc,aAAa,OAAO;AAAA,MAC3C,UAAU;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACb,SAAS,cAAc,aAAa,cAAc;AAAA,MAClD,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACV,SAAS,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACZ,SAAS,cAAc,aAAa,aAAa;AAAA,MACjD,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAAS,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAAS,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SACC,CAAC,GAAC,aAAQ,aAAR,mBAAkB,cACpB,iBAAiB,aAAa,CAAC,mBAAmB,mBAAmB,gBAAgB,CAAC;AAAA,MACvF,UAAU;AAAA,IACX;AAAA,IACA,YAAY;AAAA,MACX,SACC,iBAAiB,aAAa,CAAC,YAAY,YAAY,MAAM,CAAC,KAC9D,QAAQ,iBAAiB;AAAA,MAC1B,UAAU;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACZ,SAAS,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,iBAAiB;AAAA,MAChB,SAAS,cAAc,aAAa,MAAM,KAAK,QAAQ,iBAAiB;AAAA,MACxE,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAAS,CAAC,GAAC,aAAQ,aAAR,mBAAkB,wBAAuB,cAAc,aAAa,UAAU;AAAA,MACzF,UAAU;AAAA,IACX;AAAA,IACA,YAAY;AAAA,MACX,SAAS,cAAc,aAAa,YAAY;AAAA,MAChD,UAAU;AAAA,IAAA;AAAA,EAEZ;AAAA;"}
1
+ {"version":3,"file":"harmony115.mjs","sources":["../node_modules/react-resize-detector/build/utils.js"],"sourcesContent":["import * as React from 'react';\nimport debounce from 'lodash/debounce.js';\nimport throttle from 'lodash/throttle.js';\n\n/**\n * Wraps the resize callback with a lodash debounce / throttle based on the refresh mode\n */\nconst patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {\n switch (refreshMode) {\n case 'debounce':\n return debounce(resizeCallback, refreshRate, refreshOptions);\n case 'throttle':\n return throttle(resizeCallback, refreshRate, refreshOptions);\n default:\n return resizeCallback;\n }\n};\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nconst useCallbackRef = \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(callback) => {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => ((...args) => { var _a; return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args); }), []);\n};\n/** `useRef` hook doesn't handle conditional rendering or dynamic ref changes.\n * This hook creates a proxy that ensures that `refElement` is updated whenever the ref is changed. */\nconst useRefProxy = \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(targetRef) => {\n // we are going to use this ref to store the last element that was passed to the hook\n const [refElement, setRefElement] = React.useState((targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) || null);\n // if targetRef is passed, we need to update the refElement\n // we have to use setTimeout because ref get assigned after the hook is called\n // in the future releases we are going to remove targetRef and force users to use ref returned by the hook\n if (targetRef) {\n setTimeout(() => {\n if (targetRef.current !== refElement) {\n setRefElement(targetRef.current);\n }\n }, 0);\n }\n // this is a memo that will be called every time the ref is changed\n // This proxy will properly call setState either when the ref is called as a function or when `.current` is set\n // we call setState inside to trigger rerender\n const refProxy = React.useMemo(() => new Proxy((node) => {\n if (node !== refElement) {\n setRefElement(node);\n }\n }, {\n get(target, prop) {\n if (prop === 'current') {\n return refElement;\n }\n return target[prop];\n },\n set(target, prop, value) {\n if (prop === 'current') {\n setRefElement(value);\n }\n else {\n target[prop] = value;\n }\n return true;\n },\n }), [refElement]);\n return { refProxy, refElement, setRefElement };\n};\n/** Calculates the dimensions of the element based on the current box model.\n * @see https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model\n */\nconst getDimensions = (entry, box) => {\n // Value\t Border\t Padding\t Inner Content\n // ---------------------------------------------------\n // 'border-box'\t Yes\t Yes\t Yes\n // 'content-box'\t No\t No\t Yes\n // undefined No\t No?\t Yes\n if (box === 'border-box') {\n return {\n width: entry.borderBoxSize[0].inlineSize,\n height: entry.borderBoxSize[0].blockSize,\n };\n }\n if (box === 'content-box') {\n return {\n width: entry.contentBoxSize[0].inlineSize,\n height: entry.contentBoxSize[0].blockSize,\n };\n }\n return {\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n };\n};\n\nexport { getDimensions, patchResizeCallback, useCallbackRef, useRefProxy };\n//# sourceMappingURL=utils.js.map\n"],"names":[],"mappings":";;;AAOK,MAAC,sBAAsB,CAAC,gBAAgB,aAAa,aAAa,mBAAmB;AACtF,UAAQ,aAAW;AAAA,IACf,KAAK;AACD,aAAO,SAAS,gBAAgB,aAAa,cAAc;AAAA,IAC/D,KAAK;AACD,aAAO,SAAS,gBAAgB,aAAa,cAAc;AAAA,IAC/D;AACI,aAAO;AAAA,EACnB;AACA;AAKK,MAAC;AAAA;AAAA,EAEN,CAAC,aAAa;AACV,UAAM,cAAc,MAAM,OAAO,QAAQ;AACzC,UAAM,UAAU,MAAM;AAClB,kBAAY,UAAU;AAAA,IAC9B,CAAK;AACD,WAAO,MAAM,QAAQ,MAAO,IAAI,SAAS;AAAE,UAAI;AAAI,cAAQ,KAAK,YAAY,aAAa,QAAQ,OAAO,SAAS,SAAS,GAAG,KAAK,aAAa,GAAG,IAAI;AAAA,IAAI,GAAG,CAAA,CAAE;AAAA,EACnK;AAAA;AAGK,MAAC;AAAA;AAAA,EAEN,CAAC,cAAc;AAEX,UAAM,CAAC,YAAY,aAAa,IAAI,MAAM,UAAU,cAAc,QAAQ,cAAc,SAAS,SAAS,UAAU,YAAY,IAAI;AAIpI,QAAI,WAAW;AACX,iBAAW,MAAM;AACb,YAAI,UAAU,YAAY,YAAY;AAClC,wBAAc,UAAU,OAAO;AAAA,QAC/C;AAAA,MACS,GAAE,CAAC;AAAA,IACZ;AAII,UAAM,WAAW,MAAM,QAAQ,MAAM,IAAI,MAAM,CAAC,SAAS;AACrD,UAAI,SAAS,YAAY;AACrB,sBAAc,IAAI;AAAA,MAC9B;AAAA,IACA,GAAO;AAAA,MACC,IAAI,QAAQ,MAAM;AACd,YAAI,SAAS,WAAW;AACpB,iBAAO;AAAA,QACvB;AACY,eAAO,OAAO,IAAI;AAAA,MACrB;AAAA,MACD,IAAI,QAAQ,MAAM,OAAO;AACrB,YAAI,SAAS,WAAW;AACpB,wBAAc,KAAK;AAAA,QACnC,OACiB;AACD,iBAAO,IAAI,IAAI;AAAA,QAC/B;AACY,eAAO;AAAA,MACV;AAAA,IACT,CAAK,GAAG,CAAC,UAAU,CAAC;AAChB,WAAO,EAAE,UAAU,YAAY,cAAe;AAAA,EAClD;AAAA;AAIK,MAAC,gBAAgB,CAAC,OAAO,QAAQ;AAMlC,MAAI,QAAQ,cAAc;AACtB,WAAO;AAAA,MACH,OAAO,MAAM,cAAc,CAAC,EAAE;AAAA,MAC9B,QAAQ,MAAM,cAAc,CAAC,EAAE;AAAA,IAClC;AAAA,EACT;AACI,MAAI,QAAQ,eAAe;AACvB,WAAO;AAAA,MACH,OAAO,MAAM,eAAe,CAAC,EAAE;AAAA,MAC/B,QAAQ,MAAM,eAAe,CAAC,EAAE;AAAA,IACnC;AAAA,EACT;AACI,SAAO;AAAA,IACH,OAAO,MAAM,YAAY;AAAA,IACzB,QAAQ,MAAM,YAAY;AAAA,EAC7B;AACL;","x_google_ignoreList":[0]}
@@ -1,33 +1,90 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const navigationItems = [
4
- {
5
- key: "editor",
6
- labelKey: "Editor",
7
- path: ({ projectId }) => `/project/${projectId}/editor`
8
- },
9
- {
10
- key: "dashboard",
11
- labelKey: "Download",
12
- path: ({ projectId }) => `/project/${projectId}/dashboard`
13
- },
14
- {
15
- key: "contributors",
16
- labelKey: "Contributors",
17
- path: ({ projectId }) => `/project/${projectId}/contributors`
18
- },
19
- {
20
- key: "orders",
21
- labelKey: "Human proofreading",
22
- path: ({ projectId }) => `/project/${projectId}/orders`,
23
- shouldShow: ({ flags }) => flags.ap_feature_hraas === "on"
24
- },
25
- {
26
- key: "billing",
27
- labelKey: "Billing",
28
- path: ({ projectId }) => `/project/${projectId}/billing`,
29
- shouldShow: ({ flags }) => flags.ap_feature_billing === "on"
30
- }
31
- ];
32
- exports.navigationItems = navigationItems;
3
+ const permissions = require("./harmony129.cjs");
4
+ const getProjectNavigationVisibilityMap = (project, adminRights, isFeatureEnabled) => {
5
+ var _a, _b;
6
+ return {
7
+ upload: {
8
+ visible: permissions.hasAdminRight(adminRights, "upload"),
9
+ disabled: false
10
+ },
11
+ download: {
12
+ visible: permissions.hasAdminRight(adminRights, "download"),
13
+ disabled: false
14
+ },
15
+ // TODO: HOME-1009, Clean up after permission management
16
+ // -- There is a plan for "Install apps" permission. Right..?
17
+ apps: {
18
+ visible: true,
19
+ disabled: false
20
+ },
21
+ // TODO: HOME-1009, Clean up after permission management
22
+ // -- There is a plan for "Install apps" permission. Right..?
23
+ contentManagement: {
24
+ visible: project.project_type === "content_integration" && permissions.hasAdminRight(adminRights, "keys"),
25
+ disabled: false
26
+ },
27
+ editor: {
28
+ visible: true,
29
+ disabled: false
30
+ },
31
+ files: {
32
+ visible: isFeatureEnabled("lionLfcFilesManagement") && project.project_type === "paged_documents" && permissions.hasAnyAdminRight(adminRights, ["upload", "download"]),
33
+ disabled: false
34
+ },
35
+ tasks: {
36
+ visible: permissions.hasAdminRight(adminRights, "tasks"),
37
+ disabled: false
38
+ },
39
+ contributors: {
40
+ visible: permissions.hasAdminRight(adminRights, "contributors"),
41
+ disabled: false
42
+ },
43
+ workflows: {
44
+ visible: permissions.hasAdminRight(adminRights, "settings"),
45
+ disabled: false
46
+ },
47
+ screenshots: {
48
+ visible: permissions.hasAdminRight(adminRights, "screenshots"),
49
+ disabled: false
50
+ },
51
+ glossary: {
52
+ visible: permissions.hasAdminRight(adminRights, "glossary"),
53
+ disabled: false
54
+ },
55
+ more: {
56
+ visible: true,
57
+ disabled: false
58
+ },
59
+ settings: {
60
+ visible: permissions.hasAdminRight(adminRights, "settings"),
61
+ disabled: false
62
+ },
63
+ branches: {
64
+ visible: !!((_a = project.settings) == null ? void 0 : _a.branching) && permissions.hasAnyAdminRight(adminRights, ["branches_create", "create_branches", "branches_merge"]),
65
+ disabled: false
66
+ },
67
+ otaBundles: {
68
+ visible: permissions.hasAnyAdminRight(adminRights, ["download", "settings", "keys"]) && project.project_type === "localization_files",
69
+ disabled: false
70
+ },
71
+ automations: {
72
+ visible: permissions.hasAdminRight(adminRights, "settings"),
73
+ disabled: false
74
+ },
75
+ duplicateFinder: {
76
+ visible: permissions.hasAdminRight(adminRights, "keys") && project.project_type === "localization_files",
77
+ disabled: false
78
+ },
79
+ activity: {
80
+ visible: !!((_b = project.settings) == null ? void 0 : _b.offline_translation) || permissions.hasAdminRight(adminRights, "activity"),
81
+ disabled: false
82
+ },
83
+ statistics: {
84
+ visible: permissions.hasAdminRight(adminRights, "statistics"),
85
+ disabled: false
86
+ }
87
+ };
88
+ };
89
+ exports.getProjectNavigationVisibilityMap = getProjectNavigationVisibilityMap;
33
90
  //# sourceMappingURL=harmony116.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony116.cjs","sources":["../src/features/navigation/schemas/navigationSchema.ts"],"sourcesContent":["import type { DropdownItem, NavItemIcon } from '@features/navigation/types/navigation'\n\nexport type NavKey = 'editor' | 'contributors' | 'orders' | 'billing' | 'settings' | 'dashboard'\n\nexport interface NavigationItem {\n\tkey: NavKey\n\tlabelKey: string // TODO: i18n key inside this package\n\tpath: ({ projectId }: { projectId: string }) => string\n\n\ticon?: NavItemIcon\n\tdropdown?: DropdownItem[][]\n\tbadge?: number | ((ctx: NavCtx) => number)\n\n\tshouldShow?: (ctx: NavCtx) => boolean\n\tdisabled?: boolean | ((ctx: NavCtx) => boolean)\n\tisActive?: (pathname: string) => boolean // custom match, else fallback\n}\n\n/** What the gate functions receive */\nexport interface NavCtx {\n\tflags: Record<string, string>\n\tpathname: string\n\tpermissions?: Array<string> // e.g. contributor admin_rights //TODO: Provide type for permissions\n}\n\n// TODO: Handle Translations on harmony side.\nexport const navigationItems: NavigationItem[] = [\n\t{\n\t\tkey: 'editor',\n\t\tlabelKey: 'Editor',\n\t\tpath: ({ projectId }) => `/project/${projectId}/editor`,\n\t},\n\t{\n\t\tkey: 'dashboard',\n\t\tlabelKey: 'Download',\n\t\tpath: ({ projectId }) => `/project/${projectId}/dashboard`,\n\t},\n\t{\n\t\tkey: 'contributors',\n\t\tlabelKey: 'Contributors',\n\t\tpath: ({ projectId }) => `/project/${projectId}/contributors`,\n\t},\n\n\t{\n\t\tkey: 'orders',\n\t\tlabelKey: 'Human proofreading',\n\t\tpath: ({ projectId }) => `/project/${projectId}/orders`,\n\t\tshouldShow: ({ flags }) => flags.ap_feature_hraas === 'on',\n\t},\n\t{\n\t\tkey: 'billing',\n\t\tlabelKey: 'Billing',\n\t\tpath: ({ projectId }) => `/project/${projectId}/billing`,\n\t\tshouldShow: ({ flags }) => flags.ap_feature_billing === 'on',\n\t},\n]\n"],"names":[],"mappings":";;AA0BO,MAAM,kBAAoC;AAAA,EAChD;AAAA,IACC,KAAK;AAAA,IACL,UAAU;AAAA,IACV,MAAM,CAAC,EAAE,UAAU,MAAM,YAAY,SAAS;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,KAAK;AAAA,IACL,UAAU;AAAA,IACV,MAAM,CAAC,EAAE,UAAU,MAAM,YAAY,SAAS;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,KAAK;AAAA,IACL,UAAU;AAAA,IACV,MAAM,CAAC,EAAE,UAAU,MAAM,YAAY,SAAS;AAAA,EAC/C;AAAA,EAEA;AAAA,IACC,KAAK;AAAA,IACL,UAAU;AAAA,IACV,MAAM,CAAC,EAAE,UAAU,MAAM,YAAY,SAAS;AAAA,IAC9C,YAAY,CAAC,EAAE,YAAY,MAAM,qBAAqB;AAAA,EACvD;AAAA,EACA;AAAA,IACC,KAAK;AAAA,IACL,UAAU;AAAA,IACV,MAAM,CAAC,EAAE,UAAU,MAAM,YAAY,SAAS;AAAA,IAC9C,YAAY,CAAC,EAAE,YAAY,MAAM,uBAAuB;AAAA,EAAA;AAE1D;;"}
1
+ {"version":3,"file":"harmony116.cjs","sources":["../src/features/navigation/utils/toolbarVisibility.ts"],"sourcesContent":["import { hasAdminRight, hasAnyAdminRight } from '@features/auth/utils/permissions'\nimport type { Project } from '@features/node'\n\ntype ToolbarVisibility = {\n\tdisabled: boolean\n\tvisible: boolean\n}\n\nexport type ToolbarVisibilityMap = {\n\tupload: ToolbarVisibility\n\tdownload: ToolbarVisibility\n\tapps: ToolbarVisibility\n\tcontentManagement: ToolbarVisibility\n\teditor: ToolbarVisibility\n\tfiles: ToolbarVisibility\n\ttasks: ToolbarVisibility\n\tworkflows: ToolbarVisibility\n\tcontributors: ToolbarVisibility\n\tscreenshots: ToolbarVisibility\n\tglossary: ToolbarVisibility\n\tmore: ToolbarVisibility\n\tsettings: ToolbarVisibility\n\tbranches: ToolbarVisibility\n\totaBundles: ToolbarVisibility\n\tautomations: ToolbarVisibility\n\tduplicateFinder: ToolbarVisibility\n\tactivity: ToolbarVisibility\n\tstatistics: ToolbarVisibility\n}\n\nexport const getProjectNavigationVisibilityMap = (\n\tproject: Project,\n\tadminRights: string[],\n\tisFeatureEnabled: (key: string) => boolean,\n): ToolbarVisibilityMap => ({\n\tupload: {\n\t\tvisible: hasAdminRight(adminRights, 'upload'),\n\t\tdisabled: false,\n\t},\n\tdownload: {\n\t\tvisible: hasAdminRight(adminRights, 'download'),\n\t\tdisabled: false,\n\t},\n\t// TODO: HOME-1009, Clean up after permission management\n\t// -- There is a plan for \"Install apps\" permission. Right..?\n\tapps: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\t// TODO: HOME-1009, Clean up after permission management\n\t// -- There is a plan for \"Install apps\" permission. Right..?\n\tcontentManagement: {\n\t\tvisible: project.project_type === 'content_integration' && hasAdminRight(adminRights, 'keys'),\n\t\tdisabled: false,\n\t},\n\teditor: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\tfiles: {\n\t\tvisible:\n\t\t\tisFeatureEnabled('lionLfcFilesManagement') &&\n\t\t\tproject.project_type === 'paged_documents' &&\n\t\t\thasAnyAdminRight(adminRights, ['upload', 'download']),\n\t\tdisabled: false,\n\t},\n\ttasks: {\n\t\tvisible: hasAdminRight(adminRights, 'tasks'),\n\t\tdisabled: false,\n\t},\n\tcontributors: {\n\t\tvisible: hasAdminRight(adminRights, 'contributors'),\n\t\tdisabled: false,\n\t},\n\tworkflows: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tscreenshots: {\n\t\tvisible: hasAdminRight(adminRights, 'screenshots'),\n\t\tdisabled: false,\n\t},\n\tglossary: {\n\t\tvisible: hasAdminRight(adminRights, 'glossary'),\n\t\tdisabled: false,\n\t},\n\tmore: {\n\t\tvisible: true,\n\t\tdisabled: false,\n\t},\n\tsettings: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tbranches: {\n\t\tvisible:\n\t\t\t!!project.settings?.branching &&\n\t\t\thasAnyAdminRight(adminRights, ['branches_create', 'create_branches', 'branches_merge']),\n\t\tdisabled: false,\n\t},\n\totaBundles: {\n\t\tvisible:\n\t\t\thasAnyAdminRight(adminRights, ['download', 'settings', 'keys']) &&\n\t\t\tproject.project_type === 'localization_files',\n\t\tdisabled: false,\n\t},\n\tautomations: {\n\t\tvisible: hasAdminRight(adminRights, 'settings'),\n\t\tdisabled: false,\n\t},\n\tduplicateFinder: {\n\t\tvisible: hasAdminRight(adminRights, 'keys') && project.project_type === 'localization_files',\n\t\tdisabled: false,\n\t},\n\tactivity: {\n\t\tvisible: !!project.settings?.offline_translation || hasAdminRight(adminRights, 'activity'),\n\t\tdisabled: false,\n\t},\n\tstatistics: {\n\t\tvisible: hasAdminRight(adminRights, 'statistics'),\n\t\tdisabled: false,\n\t},\n})\n"],"names":["hasAdminRight","hasAnyAdminRight"],"mappings":";;;AA8BO,MAAM,oCAAoC,CAChD,SACA,aACA,qBAC2B;;AAAA;AAAA,IAC3B,QAAQ;AAAA,MACP,SAASA,YAAAA,cAAc,aAAa,QAAQ;AAAA,MAC5C,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAASA,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA;AAAA;AAAA,IAGA,MAAM;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA;AAAA;AAAA,IAGA,mBAAmB;AAAA,MAClB,SAAS,QAAQ,iBAAiB,yBAAyBA,YAAA,cAAc,aAAa,MAAM;AAAA,MAC5F,UAAU;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,MACP,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,IACA,OAAO;AAAA,MACN,SACC,iBAAiB,wBAAwB,KACzC,QAAQ,iBAAiB,qBACzBC,YAAAA,iBAAiB,aAAa,CAAC,UAAU,UAAU,CAAC;AAAA,MACrD,UAAU;AAAA,IACX;AAAA,IACA,OAAO;AAAA,MACN,SAASD,YAAAA,cAAc,aAAa,OAAO;AAAA,MAC3C,UAAU;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACb,SAASA,YAAAA,cAAc,aAAa,cAAc;AAAA,MAClD,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACV,SAASA,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACZ,SAASA,YAAAA,cAAc,aAAa,aAAa;AAAA,MACjD,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAASA,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAASA,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SACC,CAAC,GAAC,aAAQ,aAAR,mBAAkB,cACpBC,6BAAiB,aAAa,CAAC,mBAAmB,mBAAmB,gBAAgB,CAAC;AAAA,MACvF,UAAU;AAAA,IACX;AAAA,IACA,YAAY;AAAA,MACX,SACCA,YAAAA,iBAAiB,aAAa,CAAC,YAAY,YAAY,MAAM,CAAC,KAC9D,QAAQ,iBAAiB;AAAA,MAC1B,UAAU;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACZ,SAASD,YAAAA,cAAc,aAAa,UAAU;AAAA,MAC9C,UAAU;AAAA,IACX;AAAA,IACA,iBAAiB;AAAA,MAChB,SAASA,YAAc,cAAA,aAAa,MAAM,KAAK,QAAQ,iBAAiB;AAAA,MACxE,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,SAAS,CAAC,GAAC,aAAQ,aAAR,mBAAkB,wBAAuBA,YAAA,cAAc,aAAa,UAAU;AAAA,MACzF,UAAU;AAAA,IACX;AAAA,IACA,YAAY;AAAA,MACX,SAASA,YAAAA,cAAc,aAAa,YAAY;AAAA,MAChD,UAAU;AAAA,IAAA;AAAA,EAEZ;AAAA;;"}