@bigbinary/neeto-molecules 1.0.46 → 1.0.48

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/Sidebar.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { useRef, useCallback, useEffect, Children, isValidElement, cloneElement, forwardRef, useState } from 'react';
2
- import { toLower, mergeDeepLeft, not } from 'ramda';
2
+ import { toLower, mergeDeepLeft, curry, is, includes, __, not } from 'ramda';
3
3
  import { Link, useLocation, NavLink } from 'react-router-dom';
4
4
  import { NeetoIcon, Close, Search, AppSwitcher as AppSwitcher$1, ChatEmpty, Book, Gift, Keyboard, User, Settings, LeftArrow, Help } from '@bigbinary/neeto-icons';
5
5
  import { Typography, Button, Input, Tooltip, Avatar } from '@bigbinary/neetoui';
@@ -11,6 +11,7 @@ import { resetAuthTokens } from '@bigbinary/neeto-commons-frontend/utils';
11
11
  import KeyboardShortcuts from '@bigbinary/neeto-molecules/KeyboardShortcuts';
12
12
  import * as ProductLogos from '@bigbinary/neeto-icons/logos';
13
13
  import { Neeto } from '@bigbinary/neeto-icons/logos';
14
+ import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
14
15
 
15
16
  function _arrayWithHoles(arr) {
16
17
  if (Array.isArray(arr)) return arr;
@@ -32075,14 +32076,21 @@ var _excluded = ["label", "to", "icon", "description"];
32075
32076
  var Links = function Links(_ref) {
32076
32077
  var navLinks = _ref.navLinks;
32077
32078
  var location = useLocation();
32079
+ var filterByPermissions = curry(function (_ref2) {
32080
+ var permissions = _ref2.permissions;
32081
+ if (permissions) {
32082
+ return is(Array, permissions) ? permissions.some(includes(__, globalProps$1.permissions)) : globalProps$1.permissions.includes(permissions);
32083
+ }
32084
+ return true;
32085
+ });
32078
32086
  return /*#__PURE__*/React.createElement("div", {
32079
32087
  className: "neeto-molecules-sidebar__links"
32080
- }, navLinks.map(function (_ref2, mainIndex) {
32081
- var label = _ref2.label,
32082
- to = _ref2.to,
32083
- icon = _ref2.icon,
32084
- description = _ref2.description,
32085
- otherProps = _objectWithoutProperties(_ref2, _excluded);
32088
+ }, navLinks.filter(filterByPermissions).map(function (_ref3, mainIndex) {
32089
+ var label = _ref3.label,
32090
+ to = _ref3.to,
32091
+ icon = _ref3.icon,
32092
+ description = _ref3.description,
32093
+ otherProps = _objectWithoutProperties(_ref3, _excluded);
32086
32094
  var IconSVG = icon;
32087
32095
  var url = new URL(to, window.location.href);
32088
32096
  var isActive = function isActive() {