nzk-react-components 0.4.2-1 → 0.4.4

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"penguin.svg.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -122,5 +122,9 @@ export declare const ICONS: {
122
122
  'drawing-tool-sticker': JSX.Element;
123
123
  'idea-creator': JSX.Element;
124
124
  send: JSX.Element;
125
+ giraffe: JSX.Element;
126
+ penguin: JSX.Element;
127
+ flamingo: JSX.Element;
128
+ bear: JSX.Element;
125
129
  };
126
130
  export default ICONS;
@@ -125,6 +125,10 @@ var writingTypePoem = require('../../assets/icons/writing-type-poem.svg.js');
125
125
  var writingTypeReport = require('../../assets/icons/writing-type-report.svg.js');
126
126
  var writing = require('../../assets/icons/writing.svg.js');
127
127
  var zooPoint = require('../../assets/icons/zoo-point.svg.js');
128
+ var giraffe = require('../../assets/icons/giraffe.svg.js');
129
+ var penguin = require('../../assets/icons/penguin.svg.js');
130
+ var flamingo = require('../../assets/icons/flamingo.svg.js');
131
+ var bear = require('../../assets/icons/bear.svg.js');
128
132
 
129
133
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
130
134
 
@@ -253,6 +257,10 @@ var ICONS = {
253
257
  'drawing-tool-sticker': React__default['default'].createElement(drawingToolStickers, null),
254
258
  'idea-creator': React__default['default'].createElement(ideaCreator, null),
255
259
  'send': React__default['default'].createElement(send, null),
260
+ 'giraffe': React__default['default'].createElement(giraffe, null),
261
+ 'penguin': React__default['default'].createElement(penguin, null),
262
+ 'flamingo': React__default['default'].createElement(flamingo, null),
263
+ 'bear': React__default['default'].createElement(bear, null),
256
264
  };
257
265
 
258
266
  exports.ICONS = ICONS;
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"icons.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -5,5 +5,6 @@ export interface Props {
5
5
  }
6
6
  declare const useCloudinary: (props?: Props | undefined) => {
7
7
  uploadImage: (file: Blob | string, onComplete?: ((imageUrl: string) => void) | undefined) => void;
8
+ promiseUploadImage: (file: Blob | string) => Promise<string>;
8
9
  };
9
10
  export default useCloudinary;
@@ -38,8 +38,49 @@ var useCloudinary = function (props) {
38
38
  });
39
39
  }
40
40
  };
41
+ var promiseUploadImage = function (file) {
42
+ return new Promise(function (resolve, reject) {
43
+ var url = "https://api.cloudinary.com/v1_1/" + cloudName + "/upload";
44
+ var xhr = new XMLHttpRequest();
45
+ var fd = new FormData();
46
+ xhr.addEventListener('error', function () {
47
+ return reject(new Error("Couldn't reach cloudinary to upload image"));
48
+ });
49
+ xhr.open('POST', url, true);
50
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
51
+ xhr.onreadystatechange = function () {
52
+ if (xhr.readyState === 4 && xhr.status >= 200 && xhr.status < 300) {
53
+ var response = JSON.parse(xhr.responseText);
54
+ if (!response.secure_url) {
55
+ return reject(new Error("No secure_url returned by cloudinary"));
56
+ }
57
+ return resolve(response.secure_url);
58
+ }
59
+ if (xhr.readyState === 4 && xhr.status >= 300) {
60
+ return reject(new Error("Cloudinary returned error code: " + xhr.status));
61
+ }
62
+ return null;
63
+ };
64
+ fd.append('upload_preset', unsignedUploadPreset);
65
+ if (uploadTag)
66
+ fd.append('tags', uploadTag);
67
+ if (file instanceof Blob) {
68
+ fd.append('file', file);
69
+ xhr.send(fd);
70
+ }
71
+ else {
72
+ fetch(file).then(function (response) {
73
+ response.blob().then(function (blobFile) {
74
+ fd.append('file', blobFile);
75
+ xhr.send(fd);
76
+ });
77
+ });
78
+ }
79
+ });
80
+ };
41
81
  return {
42
- uploadImage: uploadImage
82
+ uploadImage: uploadImage,
83
+ promiseUploadImage: promiseUploadImage
43
84
  };
44
85
  };
45
86
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,3 +3,4 @@ import { Meta } from "@storybook/react/types-6-0";
3
3
  declare const _default: Meta<import("@storybook/react").Args>;
4
4
  export default _default;
5
5
  export declare const base64ImageUpload: Story;
6
+ export declare const base64ImagePromiseUpload: Story;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nzk-react-components",
3
- "version": "0.4.2-1",
3
+ "version": "0.4.4",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "files": [