@bigbinary/neeto-image-uploader-frontend 2.3.0 → 2.3.1

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 (44) hide show
  1. package/app/javascript/src/translations/en.json +2 -2
  2. package/dist/AssetLibrary.js +7 -22
  3. package/dist/AssetLibrary.js.map +1 -1
  4. package/dist/BasicImageUploader.js +3 -3
  5. package/dist/ImageUploader.js +38 -18
  6. package/dist/ImageUploader.js.map +1 -1
  7. package/dist/{ImageWithFallback-aacc383b.js → ImageWithFallback-28c61349.js} +6 -4
  8. package/dist/ImageWithFallback-28c61349.js.map +1 -0
  9. package/dist/{ImageWithFallback-a45f3f4a.js → ImageWithFallback-85563e43.js} +6 -4
  10. package/dist/ImageWithFallback-85563e43.js.map +1 -0
  11. package/dist/cjs/AssetLibrary.js +6 -21
  12. package/dist/cjs/AssetLibrary.js.map +1 -1
  13. package/dist/cjs/BasicImageUploader.js +3 -3
  14. package/dist/cjs/ImageUploader.js +37 -17
  15. package/dist/cjs/ImageUploader.js.map +1 -1
  16. package/dist/cjs/hooks.js +3 -3
  17. package/dist/cjs/index.js +5 -5
  18. package/dist/hooks.js +3 -3
  19. package/dist/{index-7f064861.js → index-69559a7a.js} +3 -1
  20. package/dist/index-69559a7a.js.map +1 -0
  21. package/dist/{index-b9963255.js → index-c128d963.js} +3 -2
  22. package/dist/index-c128d963.js.map +1 -0
  23. package/dist/index.js +5 -5
  24. package/dist/{useImageUploader-36a03350.js → useImageUploader-1dec0b7c.js} +72 -46
  25. package/dist/useImageUploader-1dec0b7c.js.map +1 -0
  26. package/dist/{useImageUploader-550a5fdc.js → useImageUploader-6fb55946.js} +72 -46
  27. package/dist/useImageUploader-6fb55946.js.map +1 -0
  28. package/dist/{useProfileImageUpload-f0088c2a.js → useProfileImageUpload-7035b8b4.js} +4 -4
  29. package/dist/useProfileImageUpload-7035b8b4.js.map +1 -0
  30. package/dist/{useProfileImageUpload-837e76b8.js → useProfileImageUpload-eeeed267.js} +4 -4
  31. package/dist/useProfileImageUpload-eeeed267.js.map +1 -0
  32. package/dist/{utils-88cce499.js → utils-b5f13248.js} +3 -3
  33. package/dist/{utils-88cce499.js.map → utils-b5f13248.js.map} +1 -1
  34. package/dist/{utils-96eacd77.js → utils-fc138f60.js} +3 -3
  35. package/dist/{utils-96eacd77.js.map → utils-fc138f60.js.map} +1 -1
  36. package/package.json +29 -29
  37. package/dist/ImageWithFallback-a45f3f4a.js.map +0 -1
  38. package/dist/ImageWithFallback-aacc383b.js.map +0 -1
  39. package/dist/index-7f064861.js.map +0 -1
  40. package/dist/index-b9963255.js.map +0 -1
  41. package/dist/useImageUploader-36a03350.js.map +0 -1
  42. package/dist/useImageUploader-550a5fdc.js.map +0 -1
  43. package/dist/useProfileImageUpload-837e76b8.js.map +0 -1
  44. package/dist/useProfileImageUpload-f0088c2a.js.map +0 -1
@@ -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,5 +1,5 @@
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';
2
- import { _ as _defineProperty$1, a as _slicedToArray$1, I as IS_DEVELOPMENT_OR_HEROKU_ENV, b as ImageKit } from './index-b9963255.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-fc138f60.js';
2
+ import { _ as _defineProperty$1, a as _slicedToArray$1, I as IS_DEVELOPMENT_OR_HEROKU_ENV, b as ImageKit } from './index-c128d963.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';
5
5
  import NeetoUIModal from '@bigbinary/neetoui/Modal';
@@ -10,13 +10,13 @@ import Toastr from '@bigbinary/neetoui/Toastr';
10
10
  import Typography from '@bigbinary/neetoui/Typography';
11
11
  import { mergeLeft, mergeRight, identity, clamp, curry, prop, pluck, filter, includes, append, isEmpty, identical, isNil, assoc, equals, groupBy, isNotNil, keys, pick, map, not, move, head, reverse, is, modify, __, trim, toLower, concat } from 'ramda';
12
12
  import { useTranslation, Trans } from 'react-i18next';
13
- import { c as commonjsGlobal$1, g as getDefaultExportFromCjs$1, Q as QUERY_KEYS$1, A as ASSETS_STALE_TIME, a as getAugmentedNamespace, U as UNSPLASH_STALE_TIME, d as directUploadsApi, _ as _asyncToGenerator, b as _regeneratorRuntime, u as useCreateBlob, e as useImageUploader } from './useImageUploader-36a03350.js';
13
+ import { c as commonjsGlobal$1, g as getDefaultExportFromCjs$1, Q as QUERY_KEYS$1, A as ASSETS_STALE_TIME, a as getAugmentedNamespace, U as UNSPLASH_STALE_TIME, d as directUploadsApi, _ as _asyncToGenerator, b as _regeneratorRuntime, u as useCreateBlob, e as useImageUploader, f as generateASCIIFileName } from './useImageUploader-1dec0b7c.js';
14
14
  import classnames from 'classnames';
15
15
  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),
@@ -10107,7 +10092,7 @@ var Modal = function Modal(_ref) {
10107
10092
  });
10108
10093
  } else {
10109
10094
  var payload = {
10110
- filename: editedImage.name,
10095
+ filename: generateASCIIFileName(editedImage.name),
10111
10096
  byte_size: editedImage.size,
10112
10097
  content_type: editedImage.fileType,
10113
10098
  checksum: editedImage.fileId,