@dreamcommerce/aurora 2.8.1-24 → 2.8.1-26

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.
@@ -12,7 +12,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
12
 
13
13
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
14
 
15
- const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, onError, onChange, onImageSizeUpdated, allowedExtensions = [
15
+ const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors: initialErrors, onError, onChange, onImageSizeUpdated, allowedExtensions = [
16
16
  constants.FILES_EXTENSIONS.WEBP,
17
17
  constants.FILES_EXTENSIONS.JPG,
18
18
  constants.FILES_EXTENSIONS.PNG,
@@ -20,8 +20,13 @@ const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, onErro
20
20
  constants.FILES_EXTENSIONS.SVG,
21
21
  constants.FILES_EXTENSIONS.JPEG
22
22
  ] }) => {
23
+ const [errors, setErrors] = React.useState([]);
23
24
  const httpApi = use_http_api.useHttpApi();
24
25
  const pendingRequestRef = React__default['default'].useRef();
26
+ React.useEffect(() => {
27
+ initialErrors && setErrors(initialErrors);
28
+ console.log('XhrImagePicker', initialErrors);
29
+ }, [initialErrors]);
25
30
  const handleControlChange = async (fileList) => {
26
31
  onChange === null || onChange === void 0 ? void 0 : onChange(fileList);
27
32
  if (!fileList || !fileList.length)
@@ -42,7 +47,6 @@ const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, onErro
42
47
  React.useEffect(() => {
43
48
  return () => { var _a; return (_a = pendingRequestRef.current) === null || _a === void 0 ? void 0 : _a.call(pendingRequestRef); };
44
49
  }, []);
45
- console.log('XhrImagePicker', errors);
46
50
  return (React__default['default'].createElement(index['default'], { id: id, name: name, onChange: handleControlChange, onError: onError, errors: errors, allowedExtensions: allowedExtensions, initialFile: initialFile, onImageSizeUpdated: onImageSizeUpdated }));
47
51
  };
48
52
 
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,10 +1,10 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import { FILES_EXTENSIONS } from '../file_picker/constants.js';
3
3
  import { REQUEST_TYPES } from '../../../../star_core/build/esm/packages/star_core/src/features/http_requester/http_requester_contants.js';
4
4
  import ImagePicker from '../image_picker/index.js';
5
5
  import { useHttpApi } from '../../hooks/use_http_api.js';
6
6
 
7
- const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, onError, onChange, onImageSizeUpdated, allowedExtensions = [
7
+ const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors: initialErrors, onError, onChange, onImageSizeUpdated, allowedExtensions = [
8
8
  FILES_EXTENSIONS.WEBP,
9
9
  FILES_EXTENSIONS.JPG,
10
10
  FILES_EXTENSIONS.PNG,
@@ -12,8 +12,13 @@ const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, onErro
12
12
  FILES_EXTENSIONS.SVG,
13
13
  FILES_EXTENSIONS.JPEG
14
14
  ] }) => {
15
+ const [errors, setErrors] = useState([]);
15
16
  const httpApi = useHttpApi();
16
17
  const pendingRequestRef = React.useRef();
18
+ useEffect(() => {
19
+ initialErrors && setErrors(initialErrors);
20
+ console.log('XhrImagePicker', initialErrors);
21
+ }, [initialErrors]);
17
22
  const handleControlChange = async (fileList) => {
18
23
  onChange === null || onChange === void 0 ? void 0 : onChange(fileList);
19
24
  if (!fileList || !fileList.length)
@@ -34,7 +39,6 @@ const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, onErro
34
39
  useEffect(() => {
35
40
  return () => { var _a; return (_a = pendingRequestRef.current) === null || _a === void 0 ? void 0 : _a.call(pendingRequestRef); };
36
41
  }, []);
37
- console.log('XhrImagePicker', errors);
38
42
  return (React.createElement(ImagePicker, { id: id, name: name, onChange: handleControlChange, onError: onError, errors: errors, allowedExtensions: allowedExtensions, initialFile: initialFile, onImageSizeUpdated: onImageSizeUpdated }));
39
43
  };
40
44
 
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@dreamcommerce/aurora",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "2.8.1-24",
5
+ "version": "2.8.1-26",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",