@configuratorware/configurator-frontendgui 1.29.4 → 1.30.0
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/App/Modules/Creator/Components/Option/index.js +2 -2
- package/App/Modules/Creator/Components/OptionsList/index.js +54 -28
- package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +5 -6
- package/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +1 -1
- package/App/Modules/Designer/Components/ImageEditDialog/index.js +3 -1
- package/App/Modules/Designer/Containers/ImageEditDialog.js +163 -113
- package/App/Modules/Designer/Utils/SvgFixers.js +59 -0
- package/App/Modules/Designer/Utils/Transformers.js +17 -10
- package/App/Reducers/ImageGallery/Selectors.js +6 -3
- package/App/Services/AnalyticsService.js +13 -64
- package/App/Services/ConfiguratorService.js +4 -2
- package/App/Services/DesignDataService.js +125 -138
- package/App/configuration.js +1 -1
- package/package.json +4 -4
- package/src/App/Modules/Creator/Components/Option/__snapshots__/index.test.js.snap +2 -2
- package/src/App/Modules/Creator/Components/Option/index.js +12 -2
- package/src/App/Modules/Creator/Components/OptionsList/index.js +46 -32
- package/src/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +5 -6
- package/src/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +1 -1
- package/src/App/Modules/Designer/Components/ImageEditDialog/index.js +3 -1
- package/src/App/Modules/Designer/Containers/ImageEditDialog.js +36 -12
- package/src/App/Modules/Designer/Utils/SvgFixers.js +36 -0
- package/src/App/Modules/Designer/Utils/Transformers.js +6 -3
- package/src/App/Modules/Designer/Utils/__tests__/Transformers.test.js +2 -2
- package/src/App/Reducers/ImageGallery/Selectors.js +5 -3
- package/src/App/Services/AnalyticsService.js +7 -20
- package/src/App/Services/ConfiguratorService.js +3 -2
- package/src/App/Services/DesignDataService.js +39 -24
- package/src/App/Services/__tests__/AnalyticsService.test.js +24 -37
- package/src/App/configuration.js +1 -1
|
@@ -71,14 +71,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
71
71
|
|
|
72
72
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
73
73
|
|
|
74
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
75
|
-
|
|
76
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
77
|
-
|
|
78
74
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
79
75
|
|
|
80
76
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
81
77
|
|
|
78
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
79
|
+
|
|
80
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
81
|
+
|
|
82
82
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
83
83
|
|
|
84
84
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -181,6 +181,48 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
181
181
|
|
|
182
182
|
_defineProperty(_assertThisInitialized(_this), "lastImageUpdateData", null);
|
|
183
183
|
|
|
184
|
+
_defineProperty(_assertThisInitialized(_this), "updateOriginalPreview", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
185
|
+
var image, previewUrl, isSvg, svgContent, preview;
|
|
186
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
187
|
+
while (1) {
|
|
188
|
+
switch (_context.prev = _context.next) {
|
|
189
|
+
case 0:
|
|
190
|
+
image = _this.props.image;
|
|
191
|
+
previewUrl = "".concat((0, _configuration.getConf)('network.host')).concat(image.preview.url);
|
|
192
|
+
isSvg = previewUrl && /\.svg$/.test(previewUrl);
|
|
193
|
+
|
|
194
|
+
if (!isSvg) {
|
|
195
|
+
_context.next = 11;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
_context.next = 6;
|
|
200
|
+
return (0, _DesignDataService.getSvgContent)(previewUrl, true);
|
|
201
|
+
|
|
202
|
+
case 6:
|
|
203
|
+
svgContent = _context.sent;
|
|
204
|
+
preview = (0, _DesignDataService.applySvgContentOperations)(image.preview, null, svgContent);
|
|
205
|
+
|
|
206
|
+
_this.setState({
|
|
207
|
+
originalImagePreview: preview
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
_context.next = 12;
|
|
211
|
+
break;
|
|
212
|
+
|
|
213
|
+
case 11:
|
|
214
|
+
_this.setState({
|
|
215
|
+
originalImagePreview: previewUrl
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
case 12:
|
|
219
|
+
case "end":
|
|
220
|
+
return _context.stop();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}, _callee);
|
|
224
|
+
})));
|
|
225
|
+
|
|
184
226
|
_defineProperty(_assertThisInitialized(_this), "setUpload", function (upload) {
|
|
185
227
|
_this.setState({
|
|
186
228
|
upload: upload
|
|
@@ -228,7 +270,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
228
270
|
});
|
|
229
271
|
|
|
230
272
|
_defineProperty(_assertThisInitialized(_this), "handleStateChange", /*#__PURE__*/function () {
|
|
231
|
-
var
|
|
273
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(partialState) {
|
|
232
274
|
var options,
|
|
233
275
|
displayColorPreview,
|
|
234
276
|
image,
|
|
@@ -239,12 +281,12 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
239
281
|
vectorizeThreshold,
|
|
240
282
|
vectorizeMaxColorAmount,
|
|
241
283
|
vectorizeOriginalColorsMap,
|
|
242
|
-
|
|
243
|
-
return regeneratorRuntime.wrap(function
|
|
284
|
+
_args2 = arguments;
|
|
285
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
244
286
|
while (1) {
|
|
245
|
-
switch (
|
|
287
|
+
switch (_context2.prev = _context2.next) {
|
|
246
288
|
case 0:
|
|
247
|
-
options =
|
|
289
|
+
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
248
290
|
displayColorPreview = options.displayColorPreview;
|
|
249
291
|
image = _this.props.image;
|
|
250
292
|
nextState = _objectSpread(_objectSpread({}, _this.state), partialState);
|
|
@@ -254,22 +296,22 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
254
296
|
operations = getOperationsFromState(nextState);
|
|
255
297
|
|
|
256
298
|
if (!(!image || (0, _isMatch["default"])(image.operations, operations) && image.displayColorPreview === displayColorPreview)) {
|
|
257
|
-
|
|
299
|
+
_context2.next = 8;
|
|
258
300
|
break;
|
|
259
301
|
}
|
|
260
302
|
|
|
261
|
-
return
|
|
303
|
+
return _context2.abrupt("return");
|
|
262
304
|
|
|
263
305
|
case 8:
|
|
264
306
|
_this.continueBlocked = true;
|
|
265
|
-
|
|
266
|
-
|
|
307
|
+
_context2.prev = 9;
|
|
308
|
+
_context2.next = 12;
|
|
267
309
|
return _this.props.editFile(operations, image, displayColorPreview !== undefined && {
|
|
268
310
|
displayColorPreview: displayColorPreview
|
|
269
311
|
});
|
|
270
312
|
|
|
271
313
|
case 12:
|
|
272
|
-
result =
|
|
314
|
+
result = _context2.sent;
|
|
273
315
|
vectorizeColorsMap = result.vectorizeColorsMap, vectorizeThreshold = result.vectorizeThreshold, vectorizeMaxColorAmount = result.vectorizeMaxColorAmount, vectorizeOriginalColorsMap = result.vectorizeOriginalColorsMap;
|
|
274
316
|
|
|
275
317
|
_this.setState({
|
|
@@ -280,20 +322,20 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
280
322
|
});
|
|
281
323
|
|
|
282
324
|
case 15:
|
|
283
|
-
|
|
325
|
+
_context2.prev = 15;
|
|
284
326
|
_this.continueBlocked = false;
|
|
285
|
-
return
|
|
327
|
+
return _context2.finish(15);
|
|
286
328
|
|
|
287
329
|
case 18:
|
|
288
330
|
case "end":
|
|
289
|
-
return
|
|
331
|
+
return _context2.stop();
|
|
290
332
|
}
|
|
291
333
|
}
|
|
292
|
-
},
|
|
334
|
+
}, _callee2, null, [[9,, 15, 18]]);
|
|
293
335
|
}));
|
|
294
336
|
|
|
295
337
|
return function (_x) {
|
|
296
|
-
return
|
|
338
|
+
return _ref2.apply(this, arguments);
|
|
297
339
|
};
|
|
298
340
|
}());
|
|
299
341
|
|
|
@@ -326,62 +368,62 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
326
368
|
}));
|
|
327
369
|
});
|
|
328
370
|
|
|
329
|
-
_defineProperty(_assertThisInitialized(_this), "onColorImageStateReset", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
330
|
-
return regeneratorRuntime.wrap(function
|
|
371
|
+
_defineProperty(_assertThisInitialized(_this), "onColorImageStateReset", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
372
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
331
373
|
while (1) {
|
|
332
|
-
switch (
|
|
374
|
+
switch (_context3.prev = _context3.next) {
|
|
333
375
|
case 0:
|
|
334
|
-
|
|
376
|
+
_context3.next = 2;
|
|
335
377
|
return _this.props.resetColorizing();
|
|
336
378
|
|
|
337
379
|
case 2:
|
|
338
380
|
case "end":
|
|
339
|
-
return
|
|
381
|
+
return _context3.stop();
|
|
340
382
|
}
|
|
341
383
|
}
|
|
342
|
-
},
|
|
384
|
+
}, _callee3);
|
|
343
385
|
})));
|
|
344
386
|
|
|
345
387
|
_defineProperty(_assertThisInitialized(_this), "selectColor", /*#__PURE__*/function () {
|
|
346
|
-
var
|
|
388
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(colorKey, newColor) {
|
|
347
389
|
var vectorizeColorsMap, colorKeys, _colorKey, _iterator, _step, _colorKey2;
|
|
348
390
|
|
|
349
|
-
return regeneratorRuntime.wrap(function
|
|
391
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
350
392
|
while (1) {
|
|
351
|
-
switch (
|
|
393
|
+
switch (_context4.prev = _context4.next) {
|
|
352
394
|
case 0:
|
|
353
395
|
vectorizeColorsMap = (0, _cloneDeep["default"])(_this.state.vectorizeColorsMap);
|
|
354
396
|
colorKeys = (0, _Selectors2.getColorKeysForAggregatedColor)(vectorizeColorsMap, colorKey);
|
|
355
397
|
|
|
356
398
|
if (!_ServiceLocator.Services.designData.changeAllColorsNeeded()) {
|
|
357
|
-
|
|
399
|
+
_context4.next = 13;
|
|
358
400
|
break;
|
|
359
401
|
}
|
|
360
402
|
|
|
361
|
-
|
|
403
|
+
_context4.t0 = regeneratorRuntime.keys(vectorizeColorsMap);
|
|
362
404
|
|
|
363
405
|
case 4:
|
|
364
|
-
if ((
|
|
365
|
-
|
|
406
|
+
if ((_context4.t1 = _context4.t0()).done) {
|
|
407
|
+
_context4.next = 11;
|
|
366
408
|
break;
|
|
367
409
|
}
|
|
368
410
|
|
|
369
|
-
_colorKey =
|
|
411
|
+
_colorKey = _context4.t1.value;
|
|
370
412
|
|
|
371
413
|
if (vectorizeColorsMap.hasOwnProperty(_colorKey)) {
|
|
372
|
-
|
|
414
|
+
_context4.next = 8;
|
|
373
415
|
break;
|
|
374
416
|
}
|
|
375
417
|
|
|
376
|
-
return
|
|
418
|
+
return _context4.abrupt("continue", 4);
|
|
377
419
|
|
|
378
420
|
case 8:
|
|
379
421
|
vectorizeColorsMap[_colorKey] = newColor;
|
|
380
|
-
|
|
422
|
+
_context4.next = 4;
|
|
381
423
|
break;
|
|
382
424
|
|
|
383
425
|
case 11:
|
|
384
|
-
|
|
426
|
+
_context4.next = 15;
|
|
385
427
|
break;
|
|
386
428
|
|
|
387
429
|
case 13:
|
|
@@ -401,7 +443,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
401
443
|
}
|
|
402
444
|
|
|
403
445
|
case 15:
|
|
404
|
-
|
|
446
|
+
_context4.next = 17;
|
|
405
447
|
return _this.handleStateChange({
|
|
406
448
|
vectorizeColorsMap: vectorizeColorsMap
|
|
407
449
|
});
|
|
@@ -413,28 +455,28 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
413
455
|
|
|
414
456
|
case 19:
|
|
415
457
|
case "end":
|
|
416
|
-
return
|
|
458
|
+
return _context4.stop();
|
|
417
459
|
}
|
|
418
460
|
}
|
|
419
|
-
},
|
|
461
|
+
}, _callee4);
|
|
420
462
|
}));
|
|
421
463
|
|
|
422
464
|
return function (_x2, _x3) {
|
|
423
|
-
return
|
|
465
|
+
return _ref4.apply(this, arguments);
|
|
424
466
|
};
|
|
425
467
|
}());
|
|
426
468
|
|
|
427
469
|
_defineProperty(_assertThisInitialized(_this), "removeColor", /*#__PURE__*/function () {
|
|
428
|
-
var
|
|
470
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(colorKey) {
|
|
429
471
|
var vectorizeColorsMap, closestColor;
|
|
430
|
-
return regeneratorRuntime.wrap(function
|
|
472
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
431
473
|
while (1) {
|
|
432
|
-
switch (
|
|
474
|
+
switch (_context5.prev = _context5.next) {
|
|
433
475
|
case 0:
|
|
434
476
|
vectorizeColorsMap = _this.state.vectorizeColorsMap;
|
|
435
477
|
|
|
436
478
|
if (vectorizeColorsMap[colorKey]) {
|
|
437
|
-
|
|
479
|
+
_context5.next = 3;
|
|
438
480
|
break;
|
|
439
481
|
}
|
|
440
482
|
|
|
@@ -442,19 +484,19 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
442
484
|
|
|
443
485
|
case 3:
|
|
444
486
|
closestColor = (0, _ImageEditUtils.getClosestColorFromMap)(vectorizeColorsMap, vectorizeColorsMap[colorKey].value);
|
|
445
|
-
|
|
487
|
+
_context5.next = 6;
|
|
446
488
|
return _this.selectColor(colorKey, closestColor);
|
|
447
489
|
|
|
448
490
|
case 6:
|
|
449
491
|
case "end":
|
|
450
|
-
return
|
|
492
|
+
return _context5.stop();
|
|
451
493
|
}
|
|
452
494
|
}
|
|
453
|
-
},
|
|
495
|
+
}, _callee5);
|
|
454
496
|
}));
|
|
455
497
|
|
|
456
498
|
return function (_x4) {
|
|
457
|
-
return
|
|
499
|
+
return _ref5.apply(this, arguments);
|
|
458
500
|
};
|
|
459
501
|
}());
|
|
460
502
|
|
|
@@ -476,7 +518,9 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
476
518
|
});
|
|
477
519
|
|
|
478
520
|
_defineProperty(_assertThisInitialized(_this), "updatePreview", /*#__PURE__*/function () {
|
|
479
|
-
var
|
|
521
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(svgContent) {
|
|
522
|
+
var _image$preview;
|
|
523
|
+
|
|
480
524
|
var options,
|
|
481
525
|
_options$forceFetch,
|
|
482
526
|
forceFetch,
|
|
@@ -484,60 +528,69 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
484
528
|
activeTabIndex,
|
|
485
529
|
preview,
|
|
486
530
|
originalImagePreview,
|
|
531
|
+
previewUrl,
|
|
532
|
+
isSvg,
|
|
487
533
|
updateSVG,
|
|
488
534
|
forceUpdate,
|
|
489
|
-
|
|
535
|
+
_args6 = arguments;
|
|
490
536
|
|
|
491
|
-
return regeneratorRuntime.wrap(function
|
|
537
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
492
538
|
while (1) {
|
|
493
|
-
switch (
|
|
539
|
+
switch (_context6.prev = _context6.next) {
|
|
494
540
|
case 0:
|
|
495
|
-
options =
|
|
541
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
496
542
|
_options$forceFetch = options.forceFetch, forceFetch = _options$forceFetch === void 0 ? false : _options$forceFetch;
|
|
497
543
|
image = _this.props.image;
|
|
498
544
|
activeTabIndex = _this.state.activeTabIndex;
|
|
499
545
|
preview = null;
|
|
500
546
|
originalImagePreview = null;
|
|
547
|
+
previewUrl = image === null || image === void 0 ? void 0 : (_image$preview = image.preview) === null || _image$preview === void 0 ? void 0 : _image$preview.url;
|
|
548
|
+
|
|
549
|
+
if (previewUrl && activeTabIndex === 1) {
|
|
550
|
+
previewUrl = (0, _Transformers.getRasterURL)(previewUrl);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
isSvg = previewUrl && /\.svg$/.test(previewUrl);
|
|
501
554
|
|
|
502
555
|
if (!image) {
|
|
503
|
-
|
|
556
|
+
_context6.next = 23;
|
|
504
557
|
break;
|
|
505
558
|
}
|
|
506
559
|
|
|
507
|
-
updateSVG =
|
|
560
|
+
updateSVG = isSvg;
|
|
508
561
|
|
|
509
562
|
if (!updateSVG) {
|
|
510
|
-
|
|
563
|
+
_context6.next = 19;
|
|
511
564
|
break;
|
|
512
565
|
}
|
|
513
566
|
|
|
514
567
|
if (svgContent) {
|
|
515
|
-
|
|
568
|
+
_context6.next = 16;
|
|
516
569
|
break;
|
|
517
570
|
}
|
|
518
571
|
|
|
519
|
-
|
|
572
|
+
_context6.next = 15;
|
|
520
573
|
return (0, _DesignDataService.getSvgContent)(image.preview.url, false, forceFetch);
|
|
521
574
|
|
|
522
|
-
case
|
|
523
|
-
svgContent =
|
|
575
|
+
case 15:
|
|
576
|
+
svgContent = _context6.sent;
|
|
524
577
|
|
|
525
|
-
case
|
|
526
|
-
preview = (0, _DesignDataService.applySvgContentOperations)(image.preview, image.operations, svgContent);
|
|
527
|
-
|
|
578
|
+
case 16:
|
|
579
|
+
preview = (0, _DesignDataService.applySvgContentOperations)(image.preview, image.displayColorPreview ? image.operations : null, svgContent);
|
|
580
|
+
_context6.next = 23;
|
|
528
581
|
break;
|
|
529
582
|
|
|
530
|
-
case
|
|
583
|
+
case 19:
|
|
531
584
|
forceUpdate = isImageInvalidatedByChange(_this.lastImageUpdateData, image);
|
|
532
585
|
|
|
533
586
|
if (forceUpdate) {
|
|
534
587
|
_this.previewVersion = Math.random();
|
|
535
588
|
}
|
|
536
589
|
|
|
537
|
-
preview = (0,
|
|
590
|
+
preview = (0, _Selectors3.getPreviewUrlFromImageData)(previewUrl) + (_this.previewVersion ? "?".concat(_this.previewVersion) : '');
|
|
538
591
|
originalImagePreview = preview;
|
|
539
592
|
|
|
540
|
-
case
|
|
593
|
+
case 23:
|
|
541
594
|
_this.lastImageUpdateData = image;
|
|
542
595
|
|
|
543
596
|
_this.setState({
|
|
@@ -545,16 +598,16 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
545
598
|
originalImagePreview: originalImagePreview
|
|
546
599
|
});
|
|
547
600
|
|
|
548
|
-
case
|
|
601
|
+
case 25:
|
|
549
602
|
case "end":
|
|
550
|
-
return
|
|
603
|
+
return _context6.stop();
|
|
551
604
|
}
|
|
552
605
|
}
|
|
553
|
-
},
|
|
606
|
+
}, _callee6);
|
|
554
607
|
}));
|
|
555
608
|
|
|
556
609
|
return function (_x5) {
|
|
557
|
-
return
|
|
610
|
+
return _ref6.apply(this, arguments);
|
|
558
611
|
};
|
|
559
612
|
}());
|
|
560
613
|
|
|
@@ -565,78 +618,78 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
565
618
|
});
|
|
566
619
|
|
|
567
620
|
_defineProperty(_assertThisInitialized(_this), "onSelectImage", /*#__PURE__*/function () {
|
|
568
|
-
var
|
|
621
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(file) {
|
|
569
622
|
var addGalleryImageToUserImages, imageUrl, thumbUrl, fileName, vectorizeColorsMap;
|
|
570
|
-
return regeneratorRuntime.wrap(function
|
|
623
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
571
624
|
while (1) {
|
|
572
|
-
switch (
|
|
625
|
+
switch (_context7.prev = _context7.next) {
|
|
573
626
|
case 0:
|
|
574
627
|
addGalleryImageToUserImages = _this.props.addGalleryImageToUserImages;
|
|
575
628
|
imageUrl = file.imageUrl, thumbUrl = file.thumbUrl;
|
|
576
629
|
fileName = imageUrl.replace(/^.*[\\/]/, '') // get filename
|
|
577
630
|
.replace(/\.[^.$]+$/, ''); // remove extension
|
|
578
631
|
|
|
579
|
-
|
|
632
|
+
_context7.next = 5;
|
|
580
633
|
return _ServiceLocator.Services.designData.getGalleryImageColors(imageUrl);
|
|
581
634
|
|
|
582
635
|
case 5:
|
|
583
|
-
vectorizeColorsMap =
|
|
636
|
+
vectorizeColorsMap = _context7.sent;
|
|
584
637
|
addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap); // exit image upload if a gallery image is selected
|
|
585
638
|
|
|
586
639
|
_this.setUpload(null);
|
|
587
640
|
|
|
588
641
|
case 8:
|
|
589
642
|
case "end":
|
|
590
|
-
return
|
|
643
|
+
return _context7.stop();
|
|
591
644
|
}
|
|
592
645
|
}
|
|
593
|
-
},
|
|
646
|
+
}, _callee7);
|
|
594
647
|
}));
|
|
595
648
|
|
|
596
649
|
return function (_x6) {
|
|
597
|
-
return
|
|
650
|
+
return _ref7.apply(this, arguments);
|
|
598
651
|
};
|
|
599
652
|
}());
|
|
600
653
|
|
|
601
|
-
_defineProperty(_assertThisInitialized(_this), "continueClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
654
|
+
_defineProperty(_assertThisInitialized(_this), "continueClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
|
|
602
655
|
var _this$props, colorDisabled, image, shouldAddImageImmediately, colorPreviewRequirementFulfilled, _this$state, activeTabIndex, continueButtonDisabled;
|
|
603
656
|
|
|
604
|
-
return regeneratorRuntime.wrap(function
|
|
657
|
+
return regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
605
658
|
while (1) {
|
|
606
|
-
switch (
|
|
659
|
+
switch (_context8.prev = _context8.next) {
|
|
607
660
|
case 0:
|
|
608
661
|
if (!_this.continueBlocked) {
|
|
609
|
-
|
|
662
|
+
_context8.next = 2;
|
|
610
663
|
break;
|
|
611
664
|
}
|
|
612
665
|
|
|
613
|
-
return
|
|
666
|
+
return _context8.abrupt("return");
|
|
614
667
|
|
|
615
668
|
case 2:
|
|
616
669
|
_this$props = _this.props, colorDisabled = _this$props.colorDisabled, image = _this$props.image, shouldAddImageImmediately = _this$props.shouldAddImageImmediately, colorPreviewRequirementFulfilled = _this$props.colorPreviewRequirementFulfilled;
|
|
617
670
|
_this$state = _this.state, activeTabIndex = _this$state.activeTabIndex, continueButtonDisabled = _this$state.continueButtonDisabled;
|
|
618
671
|
|
|
619
672
|
if (!(activeTabIndex === 0 && shouldAddImageImmediately(image))) {
|
|
620
|
-
|
|
673
|
+
_context8.next = 13;
|
|
621
674
|
break;
|
|
622
675
|
}
|
|
623
676
|
|
|
624
677
|
_this.continueBlocked = true;
|
|
625
|
-
|
|
626
|
-
|
|
678
|
+
_context8.prev = 6;
|
|
679
|
+
_context8.next = 9;
|
|
627
680
|
return _ServiceLocator.Services.designer.imageEditDialogContinueClickHandler();
|
|
628
681
|
|
|
629
682
|
case 9:
|
|
630
|
-
|
|
683
|
+
_context8.prev = 9;
|
|
631
684
|
_this.continueBlocked = false;
|
|
632
|
-
return
|
|
685
|
+
return _context8.finish(9);
|
|
633
686
|
|
|
634
687
|
case 12:
|
|
635
|
-
return
|
|
688
|
+
return _context8.abrupt("return");
|
|
636
689
|
|
|
637
690
|
case 13:
|
|
638
691
|
if (!(activeTabIndex === 0)) {
|
|
639
|
-
|
|
692
|
+
_context8.next = 16;
|
|
640
693
|
break;
|
|
641
694
|
}
|
|
642
695
|
|
|
@@ -644,11 +697,11 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
644
697
|
activeTabIndex: image.gallery ? 2 : 1
|
|
645
698
|
});
|
|
646
699
|
|
|
647
|
-
return
|
|
700
|
+
return _context8.abrupt("return");
|
|
648
701
|
|
|
649
702
|
case 16:
|
|
650
703
|
if (!(activeTabIndex === 1 && !colorDisabled)) {
|
|
651
|
-
|
|
704
|
+
_context8.next = 19;
|
|
652
705
|
break;
|
|
653
706
|
}
|
|
654
707
|
|
|
@@ -656,55 +709,55 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
656
709
|
activeTabIndex: 2
|
|
657
710
|
});
|
|
658
711
|
|
|
659
|
-
return
|
|
712
|
+
return _context8.abrupt("return");
|
|
660
713
|
|
|
661
714
|
case 19:
|
|
662
715
|
if (!(activeTabIndex === 2 && !colorPreviewRequirementFulfilled)) {
|
|
663
|
-
|
|
716
|
+
_context8.next = 23;
|
|
664
717
|
break;
|
|
665
718
|
}
|
|
666
719
|
|
|
667
720
|
if (!(_this.embroideryNoticeRef && _this.embroideryNoticeRef.current)) {
|
|
668
|
-
|
|
721
|
+
_context8.next = 23;
|
|
669
722
|
break;
|
|
670
723
|
}
|
|
671
724
|
|
|
672
725
|
_this.embroideryNoticeRef.current.scrollIntoView();
|
|
673
726
|
|
|
674
|
-
return
|
|
727
|
+
return _context8.abrupt("return");
|
|
675
728
|
|
|
676
729
|
case 23:
|
|
677
730
|
if (!continueButtonDisabled) {
|
|
678
|
-
|
|
731
|
+
_context8.next = 27;
|
|
679
732
|
break;
|
|
680
733
|
}
|
|
681
734
|
|
|
682
735
|
if (!(_this.colorAmountNoticeRef && _this.colorAmountNoticeRef.current)) {
|
|
683
|
-
|
|
736
|
+
_context8.next = 27;
|
|
684
737
|
break;
|
|
685
738
|
}
|
|
686
739
|
|
|
687
740
|
_this.colorAmountNoticeRef.current.scrollIntoView();
|
|
688
741
|
|
|
689
|
-
return
|
|
742
|
+
return _context8.abrupt("return");
|
|
690
743
|
|
|
691
744
|
case 27:
|
|
692
745
|
_this.continueBlocked = true;
|
|
693
|
-
|
|
694
|
-
|
|
746
|
+
_context8.prev = 28;
|
|
747
|
+
_context8.next = 31;
|
|
695
748
|
return _ServiceLocator.Services.designer.imageEditDialogContinueClickHandler();
|
|
696
749
|
|
|
697
750
|
case 31:
|
|
698
|
-
|
|
751
|
+
_context8.prev = 31;
|
|
699
752
|
_this.continueBlocked = false;
|
|
700
|
-
return
|
|
753
|
+
return _context8.finish(31);
|
|
701
754
|
|
|
702
755
|
case 34:
|
|
703
756
|
case "end":
|
|
704
|
-
return
|
|
757
|
+
return _context8.stop();
|
|
705
758
|
}
|
|
706
759
|
}
|
|
707
|
-
},
|
|
760
|
+
}, _callee8, null, [[6,, 9, 12], [28,, 31, 34]]);
|
|
708
761
|
})));
|
|
709
762
|
|
|
710
763
|
_defineProperty(_assertThisInitialized(_this), "onGalleryClick", function () {
|
|
@@ -788,11 +841,8 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
788
841
|
var operationData = getDerivedOperationStateFromImageData(image);
|
|
789
842
|
var operationsChanged = !!image && !(0, _isEqual["default"])(prevOperationData, operationData);
|
|
790
843
|
|
|
791
|
-
if (image && image.preview && image.preview.url && activeTabIndex === 2 && originalImagePreview === null) {
|
|
792
|
-
|
|
793
|
-
this.setState({
|
|
794
|
-
originalImagePreview: image.gallery ? previewUrl : previewUrl.replace(/.svg$/, '.png')
|
|
795
|
-
});
|
|
844
|
+
if (image && image.preview && image.preview.url && activeTabIndex === 2 && originalImagePreview === null && !(0, _Transformers.isOriginalVector)(image)) {
|
|
845
|
+
this.updateOriginalPreview();
|
|
796
846
|
}
|
|
797
847
|
|
|
798
848
|
if (operationsChanged) {
|
|
@@ -963,8 +1013,8 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
963
1013
|
imageUploadElement: /*#__PURE__*/_react["default"].createElement(ImageUploadComponent, {
|
|
964
1014
|
innerRef: this.imageUploadRef,
|
|
965
1015
|
uploadSize: uploadSize,
|
|
966
|
-
onValidate: function onValidate(
|
|
967
|
-
var isValid =
|
|
1016
|
+
onValidate: function onValidate(_ref9) {
|
|
1017
|
+
var isValid = _ref9.isValid;
|
|
968
1018
|
return _this2.setUpload({
|
|
969
1019
|
disabled: !isValid
|
|
970
1020
|
});
|