@threedddplus/logoeditor 0.0.118 → 0.0.120

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.
@@ -33,6 +33,7 @@ import Select, { components } from 'react-select';
33
33
  import { FloatingLabel } from 'flowbite-react';
34
34
  import { ChromePicker } from 'react-color';
35
35
  import 'react-toastify/dist/ReactToastify.css';
36
+ import { createRoot } from 'react-dom/client';
36
37
 
37
38
  function _regeneratorRuntime() {
38
39
  _regeneratorRuntime = function () {
@@ -5263,7 +5264,7 @@ var initCanvas = function initCanvas() {
5263
5264
  rotateImg.src = 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/icons/rotate.png';
5264
5265
  var settingImg = document.createElement('img');
5265
5266
  settingImg.src = 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/icons/settings.png';
5266
- fabric.Object.prototype.objectCaching = true;
5267
+ fabric.Object.prototype.objectCaching = false;
5267
5268
  fabric.Object.prototype.transparentCorners = false;
5268
5269
  fabric.Object.prototype.cornerColor = '#14caf7';
5269
5270
  fabric.Object.prototype.cornerStrokeColor = '#045791';
@@ -7327,6 +7328,7 @@ var PopUpCanvas = function PopUpCanvas() {
7327
7328
  }));
7328
7329
  };
7329
7330
 
7331
+ // import sharp from 'sharp';
7330
7332
  var UploadLogo = function UploadLogo() {
7331
7333
  var _useState = useState(null),
7332
7334
  setSelectedFile = _useState[1];
@@ -7350,7 +7352,7 @@ var UploadLogo = function UploadLogo() {
7350
7352
 
7351
7353
  var svgConverter = /*#__PURE__*/function () {
7352
7354
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
7353
- var ext, tiffData, aiToSvg, objectURL;
7355
+ var ext, tiffData, aiToSvg, formData, response, blob, imageUrl;
7354
7356
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7355
7357
  while (1) switch (_context.prev = _context.next) {
7356
7358
  case 0:
@@ -7364,7 +7366,7 @@ var UploadLogo = function UploadLogo() {
7364
7366
  break;
7365
7367
  }
7366
7368
  imageToSVG(data, ext, true);
7367
- _context.next = 23;
7369
+ _context.next = 36;
7368
7370
  break;
7369
7371
  case 6:
7370
7372
  if (!(ext === 'tif' || ext === 'tiff')) {
@@ -7376,7 +7378,7 @@ var UploadLogo = function UploadLogo() {
7376
7378
  case 9:
7377
7379
  tiffData = _context.sent;
7378
7380
  imageToSVG(tiffData, ext);
7379
- _context.next = 23;
7381
+ _context.next = 36;
7380
7382
  break;
7381
7383
  case 13:
7382
7384
  if (!(ext === 'ai' || ext === 'pdf')) {
@@ -7402,14 +7404,41 @@ var UploadLogo = function UploadLogo() {
7402
7404
  loading: false
7403
7405
  });
7404
7406
  });
7405
- _context.next = 23;
7407
+ _context.next = 36;
7406
7408
  break;
7407
7409
  case 21:
7408
- objectURL = URL.createObjectURL(data);
7409
- imageToSVG(objectURL, ext);
7410
- case 23:
7410
+ // const imageBuffer = await sharp(data)
7411
+ // .resize(300, 300) // Resize the image to 300x300 pixels
7412
+ // .toBuffer();
7413
+ // const imaeBlob = new Blob([imageBuffer], { type: 'image/png' });
7414
+ // let objectURL = URL.createObjectURL(data);
7415
+ formData = new FormData();
7416
+ formData.append('image', data);
7417
+ console.log(formData);
7418
+ _context.next = 26;
7419
+ return fetch('https://imagesharpher-f4b4o225iq-ue.a.run.app/upload', {
7420
+ method: 'POST',
7421
+ body: formData
7422
+ });
7423
+ case 26:
7424
+ response = _context.sent;
7425
+ if (!response.ok) {
7426
+ _context.next = 35;
7427
+ break;
7428
+ }
7429
+ _context.next = 30;
7430
+ return response.blob();
7431
+ case 30:
7432
+ blob = _context.sent;
7433
+ imageUrl = URL.createObjectURL(blob); // setProcessedImage(imageUrl);
7434
+ imageToSVG(imageUrl, ext);
7435
+ _context.next = 36;
7436
+ break;
7437
+ case 35:
7438
+ alert('Failed to process the image');
7439
+ case 36:
7411
7440
  setSelectedFile(null);
7412
- case 24:
7441
+ case 37:
7413
7442
  case "end":
7414
7443
  return _context.stop();
7415
7444
  }
@@ -7424,7 +7453,7 @@ var UploadLogo = function UploadLogo() {
7424
7453
  }, React.createElement("div", {
7425
7454
  className: "relative w-full h-full"
7426
7455
  }, React.createElement("div", {
7427
- className: "flex justify-center w-full h-full text-center"
7456
+ className: "flex justify-center w-full h-full text-center"
7428
7457
  }, React.createElement(FileUploadButton, {
7429
7458
  onFileSelect: handleFileSelect
7430
7459
  })), React.createElement("div", {
@@ -8348,7 +8377,7 @@ var fontFamilies = [{
8348
8377
  src: 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/fonts/athletic.ttf'
8349
8378
  }, {
8350
8379
  name: 'Ballpark',
8351
- src: 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/fonts/ballpark.TTF '
8380
+ src: 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/fonts/ballpark.TTF'
8352
8381
  }, {
8353
8382
  name: 'BebasKai',
8354
8383
  src: 'https://storage.googleapis.com/3ddplusgcp/richardson-customizer/fonts/BebasKai.otf'
@@ -8371,7 +8400,7 @@ var fontFamilies = [{
8371
8400
  name: 'Copper',
8372
8401
  src: 'https://storage.googleapis.com/3ddplusgcp/richardson-customizer/fonts/copgothb.woff'
8373
8402
  }, {
8374
- name: 'Eupo Block',
8403
+ name: 'Euro Block',
8375
8404
  src: 'https://storage.googleapis.com/3ddplusgcp/richardson-customizer/fonts/handgotb.woff'
8376
8405
  }, {
8377
8406
  name: 'Full Block',
@@ -14776,5 +14805,20 @@ var LogoEditor = function LogoEditor(_ref) {
14776
14805
  }))));
14777
14806
  };
14778
14807
 
14808
+ var container = /*#__PURE__*/document.getElementById('root');
14809
+ var root = /*#__PURE__*/createRoot(container); // createRoot(container!) if you use TypeScript
14810
+ root.render(React.createElement(LogoEditor, {
14811
+ stepperId: 1,
14812
+ onApply: undefined,
14813
+ customLogoColorList: undefined,
14814
+ defaultColorList: undefined,
14815
+ logoData: undefined,
14816
+ customerId: undefined,
14817
+ onSaveLogo: undefined,
14818
+ onClose: function onClose() {
14819
+ console.log('1212i');
14820
+ }
14821
+ }));
14822
+
14779
14823
  export { index$1 as Components, LogoEditor, index as services, use3dddPlus };
14780
14824
  //# sourceMappingURL=logoeditor.esm.js.map