@threedddplus/logoeditor 0.0.119 → 0.0.121

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.
@@ -5263,7 +5263,7 @@ var initCanvas = function initCanvas() {
5263
5263
  rotateImg.src = 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/icons/rotate.png';
5264
5264
  var settingImg = document.createElement('img');
5265
5265
  settingImg.src = 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/icons/settings.png';
5266
- fabric.Object.prototype.objectCaching = true;
5266
+ fabric.Object.prototype.objectCaching = false;
5267
5267
  fabric.Object.prototype.transparentCorners = false;
5268
5268
  fabric.Object.prototype.cornerColor = '#14caf7';
5269
5269
  fabric.Object.prototype.cornerStrokeColor = '#045791';
@@ -7327,6 +7327,7 @@ var PopUpCanvas = function PopUpCanvas() {
7327
7327
  }));
7328
7328
  };
7329
7329
 
7330
+ // import sharp from 'sharp';
7330
7331
  var UploadLogo = function UploadLogo() {
7331
7332
  var _useState = useState(null),
7332
7333
  setSelectedFile = _useState[1];
@@ -7350,7 +7351,7 @@ var UploadLogo = function UploadLogo() {
7350
7351
 
7351
7352
  var svgConverter = /*#__PURE__*/function () {
7352
7353
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
7353
- var ext, tiffData, aiToSvg, objectURL;
7354
+ var ext, tiffData, aiToSvg, formData, response, blob, imageUrl;
7354
7355
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7355
7356
  while (1) switch (_context.prev = _context.next) {
7356
7357
  case 0:
@@ -7364,7 +7365,7 @@ var UploadLogo = function UploadLogo() {
7364
7365
  break;
7365
7366
  }
7366
7367
  imageToSVG(data, ext, true);
7367
- _context.next = 23;
7368
+ _context.next = 36;
7368
7369
  break;
7369
7370
  case 6:
7370
7371
  if (!(ext === 'tif' || ext === 'tiff')) {
@@ -7376,7 +7377,7 @@ var UploadLogo = function UploadLogo() {
7376
7377
  case 9:
7377
7378
  tiffData = _context.sent;
7378
7379
  imageToSVG(tiffData, ext);
7379
- _context.next = 23;
7380
+ _context.next = 36;
7380
7381
  break;
7381
7382
  case 13:
7382
7383
  if (!(ext === 'ai' || ext === 'pdf')) {
@@ -7402,14 +7403,41 @@ var UploadLogo = function UploadLogo() {
7402
7403
  loading: false
7403
7404
  });
7404
7405
  });
7405
- _context.next = 23;
7406
+ _context.next = 36;
7406
7407
  break;
7407
7408
  case 21:
7408
- objectURL = URL.createObjectURL(data);
7409
- imageToSVG(objectURL, ext);
7410
- case 23:
7409
+ // const imageBuffer = await sharp(data)
7410
+ // .resize(300, 300) // Resize the image to 300x300 pixels
7411
+ // .toBuffer();
7412
+ // const imaeBlob = new Blob([imageBuffer], { type: 'image/png' });
7413
+ // let objectURL = URL.createObjectURL(data);
7414
+ formData = new FormData();
7415
+ formData.append('image', data);
7416
+ console.log(formData);
7417
+ _context.next = 26;
7418
+ return fetch('https://imagesharpher-f4b4o225iq-ue.a.run.app/upload', {
7419
+ method: 'POST',
7420
+ body: formData
7421
+ });
7422
+ case 26:
7423
+ response = _context.sent;
7424
+ if (!response.ok) {
7425
+ _context.next = 35;
7426
+ break;
7427
+ }
7428
+ _context.next = 30;
7429
+ return response.blob();
7430
+ case 30:
7431
+ blob = _context.sent;
7432
+ imageUrl = URL.createObjectURL(blob); // setProcessedImage(imageUrl);
7433
+ imageToSVG(imageUrl, ext);
7434
+ _context.next = 36;
7435
+ break;
7436
+ case 35:
7437
+ alert('Failed to process the image');
7438
+ case 36:
7411
7439
  setSelectedFile(null);
7412
- case 24:
7440
+ case 37:
7413
7441
  case "end":
7414
7442
  return _context.stop();
7415
7443
  }
@@ -7424,7 +7452,7 @@ var UploadLogo = function UploadLogo() {
7424
7452
  }, React.createElement("div", {
7425
7453
  className: "relative w-full h-full"
7426
7454
  }, React.createElement("div", {
7427
- className: "flex justify-center w-full h-full text-center"
7455
+ className: "flex justify-center w-full h-full text-center"
7428
7456
  }, React.createElement(FileUploadButton, {
7429
7457
  onFileSelect: handleFileSelect
7430
7458
  })), React.createElement("div", {
@@ -8348,7 +8376,7 @@ var fontFamilies = [{
8348
8376
  src: 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/fonts/athletic.ttf'
8349
8377
  }, {
8350
8378
  name: 'Ballpark',
8351
- src: 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/fonts/ballpark.TTF '
8379
+ src: 'https://storage.googleapis.com/3ddplusgcp/logoEditor/assets/fonts/ballpark.TTF'
8352
8380
  }, {
8353
8381
  name: 'BebasKai',
8354
8382
  src: 'https://storage.googleapis.com/3ddplusgcp/richardson-customizer/fonts/BebasKai.otf'
@@ -8371,7 +8399,7 @@ var fontFamilies = [{
8371
8399
  name: 'Copper',
8372
8400
  src: 'https://storage.googleapis.com/3ddplusgcp/richardson-customizer/fonts/copgothb.woff'
8373
8401
  }, {
8374
- name: 'Eupo Block',
8402
+ name: 'Euro Block',
8375
8403
  src: 'https://storage.googleapis.com/3ddplusgcp/richardson-customizer/fonts/handgotb.woff'
8376
8404
  }, {
8377
8405
  name: 'Full Block',
@@ -14742,15 +14770,7 @@ var LogoEditor = function LogoEditor(_ref) {
14742
14770
  })["catch"](function (error) {
14743
14771
  return console.error('Error fetching font families:', error);
14744
14772
  });
14745
- }, [
14746
- // stepperId,
14747
- // customLogoColorList,
14748
- // defaultColorList,
14749
- // customerId,
14750
- // logoData,
14751
- // myLogoHandler,
14752
- // setSelectedStepper,
14753
- ]);
14773
+ }, [stepperId, customLogoColorList, defaultColorList, customerId, logoData, myLogoHandler, setSelectedStepper]);
14754
14774
  return React.createElement(Modal, {
14755
14775
  backdropStyle: "z-[7]",
14756
14776
  contentStyle: "top-0 bottom-0 !m-[auto] z-[7] w-[80%] p-0",