@bigbinary/neeto-image-uploader-frontend 2.2.2 → 2.2.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.
@@ -16,7 +16,7 @@ import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
16
16
  import { useMutation, useInfiniteQuery, useQueryClient, QueryClient, QueryCache, useQuery, QueryClientProvider, keepPreviousData } from '@tanstack/react-query';
17
17
  import axios from 'axios';
18
18
  import { useDebounce, withT, withTitle, useMutationWithInvalidation, useQueryParams, useBreakpoints, useFuncDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
19
- import { withEventTargetValue, getQueryParams, buildUrl, showThumbsUpToastr, hyphenize, currencyFormat } from '@bigbinary/neeto-commons-frontend/utils';
19
+ import { withEventTargetValue, getQueryParams, buildUrl, showThumbsUpToastr, hyphenize, currencyFormat, hasPermission } from '@bigbinary/neeto-commons-frontend/utils';
20
20
  import Input from '@bigbinary/neetoui/Input';
21
21
  import Switch from '@bigbinary/neetoui/Switch';
22
22
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
@@ -569,21 +569,6 @@ function _typeof$1(o) {
569
569
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
570
570
  }, _typeof$1(o);
571
571
  }
572
-
573
- var hasPermission = function hasPermission() {
574
- var _globalProps$permissi;
575
- var permissions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
576
- var type = _typeof$1(permissions);
577
- var userPermissions = (_globalProps$permissi = globalProps.permissions) !== null && _globalProps$permissi !== void 0 ? _globalProps$permissi : [];
578
- if (Object.is(type, "string")) {
579
- return userPermissions.includes(permissions);
580
- } else if (Array.isArray(permissions)) {
581
- return permissions.some(function (permission) {
582
- return userPermissions.includes(permission);
583
- });
584
- }
585
- return false;
586
- };
587
572
  var isOverflown = function isOverflown(_ref) {
588
573
  var clientWidth = _ref.clientWidth,
589
574
  clientHeight = _ref.clientHeight,
@@ -9684,7 +9669,6 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
9684
9669
  var _useBulkDestroyAssets = useBulkDestroyAssets(ASSETS_DESTROY_URL),
9685
9670
  isPending = _useBulkDestroyAssets.isPending,
9686
9671
  bulkDelete = _useBulkDestroyAssets.mutate;
9687
- var hasPermissioToDeleteImage = hasPermission(VIEW_ROLES_PERMISSION);
9688
9672
  var handleDelete = useCallback(function () {
9689
9673
  bulkDelete(deleteConfirmation.imageIds, {
9690
9674
  onSuccess: function onSuccess() {
@@ -9739,7 +9723,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
9739
9723
  children: [image === null || image === void 0 || (_image$user2 = image.user) === null || _image$user2 === void 0 ? void 0 : _image$user2.name, " | ", " ", t("neetoImageUploader.labels.unsplash")]
9740
9724
  })]
9741
9725
  }), tab === TABS[0].key && /*#__PURE__*/jsxs(Fragment, {
9742
- children: [hasPermissioToDeleteImage && /*#__PURE__*/jsx(Dropdown, {
9726
+ children: [hasPermission(VIEW_ROLES_PERMISSION) && /*#__PURE__*/jsx(Dropdown, {
9743
9727
  buttonSize: "small",
9744
9728
  buttonStyle: "tertiary",
9745
9729
  "data-cy": "image-library-image-options-".concat(index),