@bigbinary/neeto-image-uploader-frontend 1.4.11 → 1.4.12

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { createContext, PureComponent, useState, useRef, useMemo, useReducer, useEffect, useCallback, forwardRef, useImperativeHandle, Fragment } from 'react';
2
- import { mergeRight, isNil, isEmpty, equals, mergeLeft, concat, __, inc, not } from 'ramda';
2
+ import { mergeRight, isNil, isEmpty, equals, mergeLeft, concat, __, inc, pipe, values, flatten as flatten$1, join, not } from 'ramda';
3
3
  import { noop as noop$1, isNotEmpty, keysToCamelCase, findBy } from '@bigbinary/neeto-cist';
4
4
  import { Checkbox, Typography, Input, Button, Toastr, Spinner, Modal as Modal$1, Tab } from '@bigbinary/neetoui';
5
5
  import { useTranslation, Trans } from 'react-i18next';
@@ -2653,8 +2653,8 @@ var directUploadsApi = {
2653
2653
  };
2654
2654
 
2655
2655
  var QUERY_KEYS = {
2656
- ASSETS_LSIT: "assets-list",
2657
- UNSPLASH_LIST: "unsplash-list"
2656
+ ASSETS_LIST: "neeto-image-uploader-assets-list",
2657
+ UNSPLASH_LIST: "neeto-image-uploader-unsplash-list"
2658
2658
  };
2659
2659
  var ASSETS_STALE_TIME = 900000; // 15 mins
2660
2660
 
@@ -4946,12 +4946,11 @@ var assetsApi = {
4946
4946
  fetch: fetch
4947
4947
  };
4948
4948
 
4949
- var ASSETS_LIST = QUERY_KEYS.ASSETS_LIST;
4950
4949
  var useFetchAssets = function useFetchAssets(_ref) {
4951
4950
  var search = _ref.search,
4952
4951
  url = _ref.url;
4953
4952
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4954
- return useQuery([ASSETS_LIST, search], function () {
4953
+ return useQuery([QUERY_KEYS.ASSETS_LIST, search], function () {
4955
4954
  return assetsApi.fetch({
4956
4955
  search: search,
4957
4956
  url: url
@@ -6182,6 +6181,10 @@ var Modal = function Modal(_ref) {
6182
6181
  })), /*#__PURE__*/React.createElement("input", getInputProps()));
6183
6182
  };
6184
6183
 
6184
+ var getAllowedTypes = function getAllowedTypes(uploadConfig) {
6185
+ return pipe(values, flatten$1, join(", "))(uploadConfig.allowedImageTypes);
6186
+ };
6187
+
6185
6188
  var ImageUpload = function ImageUpload(_ref) {
6186
6189
  var getRootProps = _ref.getRootProps,
6187
6190
  getInputProps = _ref.getInputProps,
@@ -6222,9 +6225,10 @@ var ImageUpload = function ImageUpload(_ref) {
6222
6225
  className: "text-center leading-4",
6223
6226
  style: "body3"
6224
6227
  }, /*#__PURE__*/React.createElement(Trans, {
6225
- i18nKey: "neetoImageUploader.imageUpload.maxAllowedSize",
6228
+ i18nKey: "neetoImageUploader.imageUpload.allowedConfig",
6226
6229
  values: {
6227
- size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize
6230
+ size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize,
6231
+ fileTypes: getAllowedTypes(uploadConfig)
6228
6232
  }
6229
6233
  }))));
6230
6234
  };
@@ -6360,8 +6364,7 @@ var ImageUploader = function ImageUploader(_ref) {
6360
6364
  }),
6361
6365
  getRootProps = _useDropzoneWithValid.getRootProps,
6362
6366
  getInputProps = _useDropzoneWithValid.getInputProps,
6363
- uploadProgress = _useDropzoneWithValid.uploadProgress,
6364
- inputRef = _useDropzoneWithValid.inputRef;
6367
+ uploadProgress = _useDropzoneWithValid.uploadProgress;
6365
6368
  if (isUploading) {
6366
6369
  return /*#__PURE__*/React.createElement("div", {
6367
6370
  className: className
@@ -6386,15 +6389,6 @@ var ImageUploader = function ImageUploader(_ref) {
6386
6389
  })), /*#__PURE__*/React.createElement("div", {
6387
6390
  className: "flex items-stretch justify-center gap-2"
6388
6391
  }, /*#__PURE__*/React.createElement(Button, {
6389
- label: t("neetoImageUploader.imageUpload.change"),
6390
- style: "link",
6391
- onClick: function onClick() {
6392
- var _inputRef$current;
6393
- return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.click();
6394
- }
6395
- }), /*#__PURE__*/React.createElement("div", {
6396
- className: "neeto-ui-bg-gray-300 w-px"
6397
- }), /*#__PURE__*/React.createElement(Button, {
6398
6392
  label: t("neetoImageUploader.imageUpload.assets"),
6399
6393
  style: "link",
6400
6394
  onClick: setIsAssetLibraryOpen