@bigbinary/neeto-image-uploader-frontend 2.2.1 → 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.
@@ -44,8 +44,8 @@
44
44
  "images": "Images",
45
45
  "imageLibrary": "Image library",
46
46
  "remove": "Remove",
47
- "dragAndDropOrBrowseFile": "Drag and drop or <span>Browse</span> a file.",
48
- "selectImagefromImageLibrary": "Select from <span>Image Library</span>.",
47
+ "dragAndDropOrBrowseFile": "Drag & drop or <span>upload</span>.",
48
+ "selectImagefromImageLibrary": "Select from <span>image library</span>.",
49
49
  "edit": "Edit",
50
50
  "genericError": "Something went wrong!.",
51
51
  "fileSizeError": "File size is too large",
@@ -1,4 +1,4 @@
1
- import { O as OPTIONS, i as isNilOrEmpty, D as DEFAULT_CROP_CONFIG, a as isItemsCenter, o as onImageLoaded, g as getCroppedImageURL, b as getCropValues, I as IMAGES_PER_PAGE, c as INFINITE_SCROLLER_SIZES, d as INFINITE_SCROLLER_STYLE, T as TABS, A as ASSETS_DESTROY_URL, e as ASSETS_FETCH_URL, U as UNSPLASH_DEFAULT_NAME, f as UNSPLASH_DEFAULT_REQUEST_CONFIG, h as DEFAULT_UPLOAD_CONFIG, u as useUploadDropzone, _ as _objectWithoutProperties$2, j as UNSPLASH_URL } from './utils-96eacd77.js';
1
+ import { O as OPTIONS, i as isNilOrEmpty, D as DEFAULT_CROP_CONFIG, a as isItemsCenter, o as onImageLoaded, g as getCroppedImageURL, b as getCropValues, I as IMAGES_PER_PAGE, c as INFINITE_SCROLLER_SIZES, d as INFINITE_SCROLLER_STYLE, T as TABS, A as ASSETS_DESTROY_URL, e as ASSETS_FETCH_URL, U as UNSPLASH_DEFAULT_NAME, f as UNSPLASH_DEFAULT_REQUEST_CONFIG, h as DEFAULT_UPLOAD_CONFIG, u as useUploadDropzone, _ as _objectWithoutProperties$2, j as UNSPLASH_URL } from './utils-0360fcc5.js';
2
2
  import { _ as _defineProperty$1, a as _slicedToArray$1, I as IS_DEVELOPMENT_OR_HEROKU_ENV, b as ImageKit } from './index-b9963255.js';
3
3
  import require$$0, { useState, useEffect, useRef, createElement, useMemo, memo, Fragment as Fragment$1, useCallback } from 'react';
4
4
  import { findBy, isPresent, noop, nullSafe, removeBy, isNotEmpty, findById, toLabelAndValue, keysToSnakeCase, filterBy, slugify, _findBy, replaceById, notEquals, keysToCamelCase } from '@bigbinary/neeto-cist';
@@ -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() {
@@ -9722,6 +9706,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
9722
9706
  },
9723
9707
  children: /*#__PURE__*/jsxs("div", {
9724
9708
  className: "neeto-ui-rounded-sm neeto-ui-bg-gray-100 group absolute h-full w-full",
9709
+ "data-cy": "library-image-card",
9725
9710
  id: "unsplashImage".concat(image.id),
9726
9711
  children: [tab === TABS[1].key && /*#__PURE__*/jsxs(Fragment, {
9727
9712
  children: [/*#__PURE__*/jsx("img", {
@@ -9738,7 +9723,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
9738
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")]
9739
9724
  })]
9740
9725
  }), tab === TABS[0].key && /*#__PURE__*/jsxs(Fragment, {
9741
- children: [hasPermissioToDeleteImage && /*#__PURE__*/jsx(Dropdown, {
9726
+ children: [hasPermission(VIEW_ROLES_PERMISSION) && /*#__PURE__*/jsx(Dropdown, {
9742
9727
  buttonSize: "small",
9743
9728
  buttonStyle: "tertiary",
9744
9729
  "data-cy": "image-library-image-options-".concat(index),