@configuratorware/configurator-frontendgui 1.40.6 → 1.41.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/Designer/Containers/ImageEditDialog.js +28 -10
- package/App/Reducers/DesignArea/Selectors.js +44 -11
- package/App/Reducers/DesignData/Modifiers.js +3 -1
- package/App/Reducers/ImageGallery/Actions.js +25 -18
- package/App/Reducers/ImageGallery/Reducer.js +5 -0
- package/App/Reducers/ImageGallery/Selectors.js +1 -1
- package/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +10 -9
- package/App/Services/DesignDataService.js +494 -435
- package/App/Shared/Components/AmountPrice/index.js +175 -46
- package/App/Shared/Components/ConfigurationOverview/index.js +114 -0
- package/App/Shared/Containers/AmountPrice/index.js +2 -1
- package/App/configuration.js +1 -1
- package/package.json +4 -4
- package/public/translations/de_DE.json +1 -0
- package/src/App/Modules/Designer/Containers/ImageEditDialog.js +33 -6
- package/src/App/Reducers/DesignArea/Selectors.js +39 -9
- package/src/App/Reducers/DesignArea/__tests__/Selectors.test.js +19 -0
- package/src/App/Reducers/DesignData/Modifiers.js +3 -0
- package/src/App/Reducers/ImageGallery/Actions.js +20 -5
- package/src/App/Reducers/ImageGallery/Reducer.js +5 -0
- package/src/App/Reducers/ImageGallery/Selectors.js +4 -3
- package/src/App/Reducers/ImageGallery/__tests__/Actions.test.js +81 -7
- package/src/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +4 -1
- package/src/App/Services/DesignDataService.js +56 -16
- package/src/App/Shared/Components/AmountPrice/__snapshots__/index.test.jsx.snap +133 -8
- package/src/App/Shared/Components/AmountPrice/index.js +109 -3
- package/src/App/Shared/Components/ConfigurationOverview/index.js +58 -0
- package/src/App/Shared/Containers/AmountPrice/index.js +2 -0
- package/src/App/configuration.js +1 -1
|
@@ -555,7 +555,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
555
555
|
isSvg = previewUrl && /\.svg$/.test(previewUrl);
|
|
556
556
|
|
|
557
557
|
if (!image) {
|
|
558
|
-
_context6.next =
|
|
558
|
+
_context6.next = 22;
|
|
559
559
|
break;
|
|
560
560
|
}
|
|
561
561
|
|
|
@@ -579,7 +579,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
579
579
|
|
|
580
580
|
case 16:
|
|
581
581
|
preview = (0, _DesignDataService.applySvgContentOperations)(image.preview, image.displayColorPreview ? image.operations : null, svgContent);
|
|
582
|
-
_context6.next =
|
|
582
|
+
_context6.next = 22;
|
|
583
583
|
break;
|
|
584
584
|
|
|
585
585
|
case 19:
|
|
@@ -589,10 +589,12 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
589
589
|
_this.previewVersion = Math.random();
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
-
|
|
593
|
-
|
|
592
|
+
if (previewUrl) {
|
|
593
|
+
preview = (0, _Selectors3.getPreviewUrlFromImageData)(previewUrl) + (_this.previewVersion ? "?".concat(_this.previewVersion) : '');
|
|
594
|
+
originalImagePreview = preview;
|
|
595
|
+
}
|
|
594
596
|
|
|
595
|
-
case
|
|
597
|
+
case 22:
|
|
596
598
|
_this.lastImageUpdateData = image;
|
|
597
599
|
|
|
598
600
|
_this.setState({
|
|
@@ -600,7 +602,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
600
602
|
originalImagePreview: originalImagePreview
|
|
601
603
|
});
|
|
602
604
|
|
|
603
|
-
case
|
|
605
|
+
case 24:
|
|
604
606
|
case "end":
|
|
605
607
|
return _context6.stop();
|
|
606
608
|
}
|
|
@@ -830,7 +832,8 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
830
832
|
hasPlaceHolderImage = _this$props4.hasPlaceHolderImage,
|
|
831
833
|
isImageCompatible = _this$props4.isImageCompatible,
|
|
832
834
|
isColorMappingCompatible = _this$props4.isColorMappingCompatible,
|
|
833
|
-
vectorsRequired = _this$props4.vectorsRequired
|
|
835
|
+
vectorsRequired = _this$props4.vectorsRequired,
|
|
836
|
+
vectorizedLogoMandatory = _this$props4.vectorizedLogoMandatory;
|
|
834
837
|
var _this$state2 = this.state,
|
|
835
838
|
vectorize = _this$state2.vectorize,
|
|
836
839
|
vectorizeColorsMap = _this$state2.vectorizeColorsMap,
|
|
@@ -886,13 +889,24 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
886
889
|
});
|
|
887
890
|
}
|
|
888
891
|
|
|
889
|
-
if (activeTabIndex === 2 && vectorsRequired && !vectorize && !image.gallery) {
|
|
892
|
+
if (activeTabIndex === 2 && (vectorsRequired || vectorizedLogoMandatory) && !vectorize && !image.gallery) {
|
|
890
893
|
Object.assign(newState, {
|
|
891
894
|
vectorize: true
|
|
892
895
|
});
|
|
893
896
|
}
|
|
894
897
|
|
|
895
|
-
|
|
898
|
+
var options;
|
|
899
|
+
|
|
900
|
+
if (activeTabIndex === 2 && !image.gallery && vectorizedLogoMandatory && !image.displayColorPreview && !this.state.displayColorPreview) {
|
|
901
|
+
options = {
|
|
902
|
+
displayColorPreview: true
|
|
903
|
+
};
|
|
904
|
+
Object.assign(newState, {
|
|
905
|
+
displayColorPreview: true
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
(!(0, _isMatch["default"])(this.state, newState) || options) && this.handleStateChange(newState, options);
|
|
896
910
|
|
|
897
911
|
if ((justOpened || imageChanged) && !image.incomplete) {
|
|
898
912
|
this.updatePreview(null, {
|
|
@@ -933,6 +947,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
933
947
|
maxColorAmount = _this$props6.maxColorAmount,
|
|
934
948
|
colorDisabled = _this$props6.colorDisabled,
|
|
935
949
|
vectorsRequired = _this$props6.vectorsRequired,
|
|
950
|
+
vectorizedLogoMandatory = _this$props6.vectorizedLogoMandatory,
|
|
936
951
|
image = _this$props6.image,
|
|
937
952
|
usedColors = _this$props6.usedColors,
|
|
938
953
|
imageColorsWereEdited = _this$props6.imageColorsWereEdited,
|
|
@@ -962,7 +977,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
962
977
|
return i + 1;
|
|
963
978
|
});
|
|
964
979
|
var colorCount = (0, _size["default"])(aggregatedColors);
|
|
965
|
-
var colorPreviewBlockActive = activeTabIndex === 2 && colorCount > 0 && !isGalleryImage && (colorPreviewEnabled || !colorPreviewRequirementFulfilled);
|
|
980
|
+
var colorPreviewBlockActive = activeTabIndex === 2 && colorCount > 0 && !isGalleryImage && !vectorizedLogoMandatory && (colorPreviewEnabled || !colorPreviewRequirementFulfilled);
|
|
966
981
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_ImageEditDialog["default"], _extends({}, this.props, {
|
|
967
982
|
loaderComponent: /*#__PURE__*/_react["default"].createElement(ProgressComponent, {
|
|
968
983
|
loading: loading
|
|
@@ -1050,6 +1065,7 @@ _defineProperty(ImageEditDialogContainer, "propTypes", {
|
|
|
1050
1065
|
open: _propTypes["default"].bool,
|
|
1051
1066
|
editMode: _propTypes["default"].bool,
|
|
1052
1067
|
vectorsRequired: _propTypes["default"].bool,
|
|
1068
|
+
vectorizedLogoMandatory: _propTypes["default"].bool,
|
|
1053
1069
|
colorDisabled: _propTypes["default"].bool,
|
|
1054
1070
|
loading: _propTypes["default"].bool,
|
|
1055
1071
|
errorCode: _propTypes["default"].string,
|
|
@@ -1107,6 +1123,7 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
1107
1123
|
var colorPalettes = (0, _Selectors.getColorPalettes)(state);
|
|
1108
1124
|
var designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(state);
|
|
1109
1125
|
var vectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired');
|
|
1126
|
+
var vectorizedLogoMandatory = !!(0, _get["default"])(designProductionMethod, 'options.vectorizedLogoMandatory');
|
|
1110
1127
|
var colorDisabled = (0, _Selectors.isColoringDisabled)(state);
|
|
1111
1128
|
var userImages = getUserImages(imageGallery);
|
|
1112
1129
|
var hasPlaceHolderImage = (0, _Selectors.hasPlaceHolderImagesForActiveDesignArea)(state);
|
|
@@ -1144,6 +1161,7 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
1144
1161
|
userImages: userImages,
|
|
1145
1162
|
colorPalettes: colorPalettes,
|
|
1146
1163
|
vectorsRequired: vectorsRequired,
|
|
1164
|
+
vectorizedLogoMandatory: vectorizedLogoMandatory,
|
|
1147
1165
|
colorDisabled: colorDisabled,
|
|
1148
1166
|
uploadSize: uploadSize,
|
|
1149
1167
|
galleryHasImages: galleryHasImages,
|
|
@@ -76,7 +76,9 @@ var _exportNames = {
|
|
|
76
76
|
hasLastEditedDesignArea: true,
|
|
77
77
|
getDesignAreaPreSelection: true,
|
|
78
78
|
getDesignAreaColorAmount: true,
|
|
79
|
+
isVectorizedLogoMandatory: true,
|
|
79
80
|
getVectorizeForDesignProductionMethods: true,
|
|
81
|
+
getMandatoryVectorizationForDesignProductionMethods: true,
|
|
80
82
|
getImagesByDesignArea: true,
|
|
81
83
|
isOneLineText: true
|
|
82
84
|
};
|
|
@@ -125,7 +127,7 @@ exports.getColorsFromCanvasData = getColorsFromCanvasData;
|
|
|
125
127
|
exports.getColorsFromCanvasDataWithPalette = getColorsFromCanvasDataWithPalette;
|
|
126
128
|
exports.findSmallestFontSizeInCanvasData = findSmallestFontSizeInCanvasData;
|
|
127
129
|
exports.isOneLineText = isOneLineText;
|
|
128
|
-
exports.getImagesByDesignArea = exports.getVectorizeForDesignProductionMethods = exports.getDesignAreaColorAmount = exports.getDesignAreaPreSelection = exports.hasLastEditedDesignArea = exports.areAllDesignAreasEmpty = exports.getVectorizedImageColor = exports.areHashesCompatible = exports.getCurrentCompatibilityInfoHash = exports.getDesignAreaImageCompatibilityInfo = exports.contentHasText = exports.isPlaceholderContent = exports.getDefaultTextColor = exports.getDefaultColorsFromDesignProductionMethod = exports.getDefaultDesignAreaIdentifierFromProductionMethod = exports.getDesignAreaFromSelectedDesignView = exports.getDesignViewListForDesignAreas = exports.getCameraViewListForDesignAreaList = exports.parseColorData = exports.createColorData = exports.rgbObjToHex = exports.rgbString2hex = exports.rgbToHex = exports.calculateColorDistance = exports.hexToRgbNumbers = exports.hexToRgb = exports.isValidHex = exports.getColorPalettes = exports.hasPlaceHolderImagesForActiveDesignArea = exports.getDesignAreaIdentifierToOpen = void 0;
|
|
130
|
+
exports.getImagesByDesignArea = exports.getMandatoryVectorizationForDesignProductionMethods = exports.getVectorizeForDesignProductionMethods = exports.isVectorizedLogoMandatory = exports.getDesignAreaColorAmount = exports.getDesignAreaPreSelection = exports.hasLastEditedDesignArea = exports.areAllDesignAreasEmpty = exports.getVectorizedImageColor = exports.areHashesCompatible = exports.getCurrentCompatibilityInfoHash = exports.getDesignAreaImageCompatibilityInfo = exports.contentHasText = exports.isPlaceholderContent = exports.getDefaultTextColor = exports.getDefaultColorsFromDesignProductionMethod = exports.getDefaultDesignAreaIdentifierFromProductionMethod = exports.getDesignAreaFromSelectedDesignView = exports.getDesignViewListForDesignAreas = exports.getCameraViewListForDesignAreaList = exports.parseColorData = exports.createColorData = exports.rgbObjToHex = exports.rgbString2hex = exports.rgbToHex = exports.calculateColorDistance = exports.hexToRgbNumbers = exports.hexToRgb = exports.isValidHex = exports.getColorPalettes = exports.hasPlaceHolderImagesForActiveDesignArea = exports.getDesignAreaIdentifierToOpen = void 0;
|
|
129
131
|
|
|
130
132
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
131
133
|
|
|
@@ -157,6 +159,8 @@ var _values = _interopRequireDefault(require("lodash/values"));
|
|
|
157
159
|
|
|
158
160
|
var _createSelector = _interopRequireDefault(require("../../../Utils/Function/createSelector"));
|
|
159
161
|
|
|
162
|
+
var _memoize = _interopRequireDefault(require("../../../Utils/Function/memoize"));
|
|
163
|
+
|
|
160
164
|
var _configuration = require("../../configuration");
|
|
161
165
|
|
|
162
166
|
var _DesignDataService = require("../../Services/DesignDataService");
|
|
@@ -617,6 +621,15 @@ function getCurrentCanvasSize(state) {
|
|
|
617
621
|
return getCanvasSizeFromDesignProductionMethod(designProductionMethod);
|
|
618
622
|
}
|
|
619
623
|
|
|
624
|
+
var memoizedCanvasSize = (0, _memoize["default"])(function (width, height, isMetric, dpi) {
|
|
625
|
+
return {
|
|
626
|
+
width: width,
|
|
627
|
+
height: height,
|
|
628
|
+
isMetric: isMetric,
|
|
629
|
+
dpi: dpi
|
|
630
|
+
};
|
|
631
|
+
});
|
|
632
|
+
|
|
620
633
|
function getCanvasSizeFromDesignProductionMethod(designProductionMethod) {
|
|
621
634
|
var defaultSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : zeroSize;
|
|
622
635
|
var width = designProductionMethod.width,
|
|
@@ -627,12 +640,7 @@ function getCanvasSizeFromDesignProductionMethod(designProductionMethod) {
|
|
|
627
640
|
return defaultSize;
|
|
628
641
|
}
|
|
629
642
|
|
|
630
|
-
return
|
|
631
|
-
width: width,
|
|
632
|
-
height: height,
|
|
633
|
-
isMetric: true,
|
|
634
|
-
dpi: dpi || (0, _configuration.getConf)('designer.dpi', 300)
|
|
635
|
-
};
|
|
643
|
+
return memoizedCanvasSize(width, height, true, dpi || (0, _configuration.getConf)('designer.dpi', 300));
|
|
636
644
|
}
|
|
637
645
|
|
|
638
646
|
function getCanvasSizeFromDesignArea(state, designArea) {
|
|
@@ -1168,10 +1176,12 @@ var getDesignAreaImageCompatibilityInfo = function getDesignAreaImageCompatibili
|
|
|
1168
1176
|
}).sort();
|
|
1169
1177
|
var vectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired');
|
|
1170
1178
|
var maxColorAmount = (0, _get["default"])(designProductionMethod, 'options.maxColorAmount', 0);
|
|
1179
|
+
var vectorizedLogoMandatory = (0, _get["default"])(designProductionMethod, 'options.vectorizedLogoMandatory', false);
|
|
1171
1180
|
return {
|
|
1172
1181
|
colorPalettes: colorPalettes,
|
|
1173
1182
|
vectorsRequired: vectorsRequired,
|
|
1174
|
-
maxColorAmount: maxColorAmount
|
|
1183
|
+
maxColorAmount: maxColorAmount,
|
|
1184
|
+
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
1175
1185
|
};
|
|
1176
1186
|
};
|
|
1177
1187
|
|
|
@@ -1184,7 +1194,7 @@ var getCurrentCompatibilityInfoHash = function getCurrentCompatibilityInfoHash(s
|
|
|
1184
1194
|
exports.getCurrentCompatibilityInfoHash = getCurrentCompatibilityInfoHash;
|
|
1185
1195
|
|
|
1186
1196
|
var areHashesCompatible = function areHashesCompatible(storedHash, targetHash) {
|
|
1187
|
-
return Boolean(!targetHash || storedHash && (0, _isEqual["default"])(storedHash.colorPalettes, targetHash.colorPalettes) && (!targetHash.vectorsRequired || storedHash.vectorsRequired) && (!targetHash.maxColorAmount || storedHash.maxColorAmount <= targetHash.maxColorAmount));
|
|
1197
|
+
return Boolean(!targetHash || storedHash && (0, _isEqual["default"])(storedHash.colorPalettes, targetHash.colorPalettes) && (!targetHash.vectorsRequired || storedHash.vectorsRequired) && (!targetHash.vectorizedLogoMandatory || storedHash.vectorizedLogoMandatory) && (!targetHash.maxColorAmount || storedHash.maxColorAmount <= targetHash.maxColorAmount));
|
|
1188
1198
|
};
|
|
1189
1199
|
|
|
1190
1200
|
exports.areHashesCompatible = areHashesCompatible;
|
|
@@ -1290,13 +1300,21 @@ var getDesignAreaColorAmount = function getDesignAreaColorAmount(maxColorAmount,
|
|
|
1290
1300
|
|
|
1291
1301
|
exports.getDesignAreaColorAmount = getDesignAreaColorAmount;
|
|
1292
1302
|
|
|
1303
|
+
var isVectorizedLogoMandatory = function isVectorizedLogoMandatory(designProductionMethod) {
|
|
1304
|
+
var _designProductionMeth;
|
|
1305
|
+
|
|
1306
|
+
return !!(designProductionMethod !== null && designProductionMethod !== void 0 && (_designProductionMeth = designProductionMethod.options) !== null && _designProductionMeth !== void 0 && _designProductionMeth.vectorizedLogoMandatory);
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
exports.isVectorizedLogoMandatory = isVectorizedLogoMandatory;
|
|
1310
|
+
|
|
1293
1311
|
var getVectorizeForDesignProductionMethods = function getVectorizeForDesignProductionMethods(state, designProductionMethodIdentifier) {
|
|
1294
1312
|
var _getSelectedDesignAre3 = getSelectedDesignAreaProperties(state),
|
|
1295
1313
|
designProductionMethod = _getSelectedDesignAre3.designProductionMethod;
|
|
1296
1314
|
|
|
1297
1315
|
var newProductionMethod = getDesignProductionMethodByIdentifier(state, designProductionMethodIdentifier);
|
|
1298
|
-
var currentVectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired');
|
|
1299
|
-
var newVectorsRequired = !!(0, _get["default"])(newProductionMethod, 'options.vectorsRequired');
|
|
1316
|
+
var currentVectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired') && isVectorizedLogoMandatory(designProductionMethod);
|
|
1317
|
+
var newVectorsRequired = !!(0, _get["default"])(newProductionMethod, 'options.vectorsRequired') && isVectorizedLogoMandatory(newProductionMethod);
|
|
1300
1318
|
return {
|
|
1301
1319
|
currentVectorsRequired: currentVectorsRequired,
|
|
1302
1320
|
newVectorsRequired: newVectorsRequired
|
|
@@ -1305,6 +1323,21 @@ var getVectorizeForDesignProductionMethods = function getVectorizeForDesignProdu
|
|
|
1305
1323
|
|
|
1306
1324
|
exports.getVectorizeForDesignProductionMethods = getVectorizeForDesignProductionMethods;
|
|
1307
1325
|
|
|
1326
|
+
var getMandatoryVectorizationForDesignProductionMethods = function getMandatoryVectorizationForDesignProductionMethods(state, designProductionMethodIdentifier) {
|
|
1327
|
+
var _getSelectedDesignAre4 = getSelectedDesignAreaProperties(state),
|
|
1328
|
+
designProductionMethod = _getSelectedDesignAre4.designProductionMethod;
|
|
1329
|
+
|
|
1330
|
+
var newProductionMethod = getDesignProductionMethodByIdentifier(state, designProductionMethodIdentifier);
|
|
1331
|
+
var currentVectorsMandatory = isVectorizedLogoMandatory(designProductionMethod);
|
|
1332
|
+
var newVectorsMandatory = isVectorizedLogoMandatory(newProductionMethod);
|
|
1333
|
+
return {
|
|
1334
|
+
currentVectorsMandatory: currentVectorsMandatory,
|
|
1335
|
+
newVectorsMandatory: newVectorsMandatory
|
|
1336
|
+
};
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
exports.getMandatoryVectorizationForDesignProductionMethods = getMandatoryVectorizationForDesignProductionMethods;
|
|
1340
|
+
|
|
1308
1341
|
var getImagesByDesignArea = function getImagesByDesignArea(state, designAreaIdentifier) {
|
|
1309
1342
|
if (!designAreaIdentifier) {
|
|
1310
1343
|
designAreaIdentifier = getSelectedDesignArea(state).identifier;
|
|
@@ -87,10 +87,12 @@ var getEditDataFromOperations = function getEditDataFromOperations(imageFileName
|
|
|
87
87
|
_operations$vectorize2 = operations.vectorizeThreshold,
|
|
88
88
|
vectorizeThreshold = _operations$vectorize2 === void 0 ? null : _operations$vectorize2;
|
|
89
89
|
var maxColorAmount = +(0, _get["default"])(designProductionMethod, 'options.maxColorAmount', 0);
|
|
90
|
+
var vectorizedLogoMandatory = (0, _get["default"])(designProductionMethod, 'options.vectorizedLogoMandatory', false);
|
|
90
91
|
var vectorizeMonochrome = maxColorAmount === 1 && vectorizeThreshold === 1;
|
|
91
92
|
var result = {
|
|
92
93
|
fileName: imageFileName,
|
|
93
|
-
operations: []
|
|
94
|
+
operations: [],
|
|
95
|
+
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
94
96
|
};
|
|
95
97
|
|
|
96
98
|
if (clipping && clippingColor) {
|
|
@@ -169,30 +169,34 @@ exports.updateImage = updateImage;
|
|
|
169
169
|
|
|
170
170
|
var uploadImage = function uploadImage(file) {
|
|
171
171
|
return (0, _Actions2.createAsyncTask)(WN_UPLOAD_IMAGE, /*#__PURE__*/function () {
|
|
172
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch) {
|
|
173
|
-
var data, uploadResponse;
|
|
172
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch, getState) {
|
|
173
|
+
var designProductionMethod, vectorizedLogoMandatory, data, uploadResponse;
|
|
174
174
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
175
175
|
while (1) {
|
|
176
176
|
switch (_context.prev = _context.next) {
|
|
177
177
|
case 0:
|
|
178
|
+
designProductionMethod = (0, _Selectors2.getSelectedDesignProductionMethod)(getState());
|
|
179
|
+
vectorizedLogoMandatory = (0, _Selectors2.isVectorizedLogoMandatory)(designProductionMethod);
|
|
178
180
|
data = new FormData();
|
|
179
181
|
data.append('userImage', file);
|
|
180
182
|
data.append('userImageEditData', JSON.stringify({}));
|
|
181
183
|
dispatch(dismissError());
|
|
182
|
-
_context.next =
|
|
183
|
-
return dispatch((0, _Actions.postDataAsync)(URL_UPLOAD, data, (0, _Actions.createDefaultReceiver)(RECEIVE_IMAGE_UPLOAD_DATA
|
|
184
|
+
_context.next = 8;
|
|
185
|
+
return dispatch((0, _Actions.postDataAsync)(URL_UPLOAD, data, (0, _Actions.createDefaultReceiver)(RECEIVE_IMAGE_UPLOAD_DATA, {
|
|
186
|
+
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
187
|
+
}), {}, {}, {
|
|
184
188
|
useLocalErrorHandling: true
|
|
185
189
|
}));
|
|
186
190
|
|
|
187
|
-
case
|
|
191
|
+
case 8:
|
|
188
192
|
uploadResponse = _context.sent;
|
|
189
|
-
_context.next =
|
|
193
|
+
_context.next = 11;
|
|
190
194
|
return (0, _DesignDataService.calculateImageBrightness)(uploadResponse);
|
|
191
195
|
|
|
192
|
-
case
|
|
196
|
+
case 11:
|
|
193
197
|
return _context.abrupt("return", _context.sent);
|
|
194
198
|
|
|
195
|
-
case
|
|
199
|
+
case 12:
|
|
196
200
|
case "end":
|
|
197
201
|
return _context.stop();
|
|
198
202
|
}
|
|
@@ -200,7 +204,7 @@ var uploadImage = function uploadImage(file) {
|
|
|
200
204
|
}, _callee);
|
|
201
205
|
}));
|
|
202
206
|
|
|
203
|
-
return function (_x) {
|
|
207
|
+
return function (_x, _x2) {
|
|
204
208
|
return _ref.apply(this, arguments);
|
|
205
209
|
};
|
|
206
210
|
}());
|
|
@@ -247,31 +251,34 @@ exports.dismissError = dismissError;
|
|
|
247
251
|
var editImage = function editImage(editData, imageData) {
|
|
248
252
|
var actionOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
249
253
|
return (0, _Actions2.createAsyncTask)(WN_UPLOAD_IMAGE, /*#__PURE__*/function () {
|
|
250
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch) {
|
|
251
|
-
var data, createCopy, uploadResponse;
|
|
254
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch, getState) {
|
|
255
|
+
var designProductionMethod, vectorizedLogoMandatory, data, createCopy, uploadResponse;
|
|
252
256
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
253
257
|
while (1) {
|
|
254
258
|
switch (_context2.prev = _context2.next) {
|
|
255
259
|
case 0:
|
|
260
|
+
designProductionMethod = (0, _Selectors2.getSelectedDesignProductionMethod)(getState());
|
|
261
|
+
vectorizedLogoMandatory = (0, _Selectors2.isVectorizedLogoMandatory)(designProductionMethod);
|
|
256
262
|
data = new FormData();
|
|
257
263
|
createCopy = editData.createCopy;
|
|
258
264
|
data.append('userImageEditData', JSON.stringify(editData));
|
|
259
265
|
dispatch(dismissError());
|
|
260
|
-
_context2.next =
|
|
266
|
+
_context2.next = 8;
|
|
261
267
|
return dispatch((0, _Actions.postDataAsync)(URL_UPLOAD, data, (0, _Actions.createDefaultReceiver)(RECEIVE_IMAGE_UPLOAD_DATA, _objectSpread({
|
|
262
268
|
imageData: imageData,
|
|
263
|
-
createCopy: createCopy
|
|
269
|
+
createCopy: createCopy,
|
|
270
|
+
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
264
271
|
}, actionOptions))));
|
|
265
272
|
|
|
266
|
-
case
|
|
273
|
+
case 8:
|
|
267
274
|
uploadResponse = _context2.sent;
|
|
268
|
-
_context2.next =
|
|
275
|
+
_context2.next = 11;
|
|
269
276
|
return (0, _DesignDataService.calculateImageBrightness)(uploadResponse);
|
|
270
277
|
|
|
271
|
-
case
|
|
278
|
+
case 11:
|
|
272
279
|
return _context2.abrupt("return", _context2.sent);
|
|
273
280
|
|
|
274
|
-
case
|
|
281
|
+
case 12:
|
|
275
282
|
case "end":
|
|
276
283
|
return _context2.stop();
|
|
277
284
|
}
|
|
@@ -279,7 +286,7 @@ var editImage = function editImage(editData, imageData) {
|
|
|
279
286
|
}, _callee2);
|
|
280
287
|
}));
|
|
281
288
|
|
|
282
|
-
return function (
|
|
289
|
+
return function (_x3, _x4) {
|
|
283
290
|
return _ref2.apply(this, arguments);
|
|
284
291
|
};
|
|
285
292
|
}());
|
|
@@ -65,6 +65,11 @@ var updateDerivedImageDataProps = function updateDerivedImageDataProps(imageData
|
|
|
65
65
|
imageData.displayColorPreview = (0, _configuration.getConf)('autoPreviewVectorization', true);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
if (imageData.vectorizedLogoMandatory) {
|
|
69
|
+
imageData.colorPreviewEnabled = false;
|
|
70
|
+
imageData.displayColorPreview = true;
|
|
71
|
+
}
|
|
72
|
+
|
|
68
73
|
return imageData;
|
|
69
74
|
};
|
|
70
75
|
|
|
@@ -195,7 +195,7 @@ var isColorPreviewCompatible = function isColorPreviewCompatible(state, image, d
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
var designProductionMethod = designProductionMethodIdentifier ? (0, _Selectors2.getDesignProductionMethodByIdentifier)(state, designProductionMethodIdentifier) : (0, _Selectors2.getSelectedDesignProductionMethod)(state);
|
|
198
|
-
var colorPreviewRequired = (0, _Selectors2.designProductionMethodHasEmbroideryVisualizationEffect)(designProductionMethod);
|
|
198
|
+
var colorPreviewRequired = (0, _Selectors2.designProductionMethodHasEmbroideryVisualizationEffect)(designProductionMethod) || (0, _Selectors2.isVectorizedLogoMandatory)(designProductionMethod);
|
|
199
199
|
var displayColorPreview = image && (!!image.gallery || !!image.displayColorPreview); // do not let the user to add a raster image if the production method is embroidery
|
|
200
200
|
|
|
201
201
|
return !colorPreviewRequired || displayColorPreview || false;
|
|
@@ -69,7 +69,7 @@ var prepareImageData = function createImageDataPreProcessor() {
|
|
|
69
69
|
|
|
70
70
|
return /*#__PURE__*/function () {
|
|
71
71
|
var _prepareImageData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(designArea, imageData) {
|
|
72
|
-
var hash, state, designProductionMethod, patchedImageData, colorPreviewRequired, svgContent, svgColors, vectorizeColorsMap;
|
|
72
|
+
var hash, state, designProductionMethod, patchedImageData, colorPreviewRequired, vectorizedLogoMandatory, svgContent, svgColors, vectorizeColorsMap;
|
|
73
73
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
74
74
|
while (1) {
|
|
75
75
|
switch (_context.prev = _context.next) {
|
|
@@ -93,31 +93,32 @@ var prepareImageData = function createImageDataPreProcessor() {
|
|
|
93
93
|
|
|
94
94
|
case 6:
|
|
95
95
|
colorPreviewRequired = (0, _Selectors.designProductionMethodHasEmbroideryVisualizationEffect)(designProductionMethod);
|
|
96
|
+
vectorizedLogoMandatory = (0, _Selectors.isVectorizedLogoMandatory)(designProductionMethod);
|
|
96
97
|
|
|
97
98
|
if (!colorPreviewRequired) {
|
|
98
|
-
_context.next =
|
|
99
|
+
_context.next = 17;
|
|
99
100
|
break;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
_context.next =
|
|
103
|
+
_context.next = 11;
|
|
103
104
|
return (0, _DesignDataService.getSvgContent)(imageData.preview.url, false, true);
|
|
104
105
|
|
|
105
|
-
case
|
|
106
|
+
case 11:
|
|
106
107
|
svgContent = _context.sent;
|
|
107
108
|
svgColors = (0, _DesignDataService.getSvgColors)(svgContent, designProductionMethod);
|
|
108
109
|
vectorizeColorsMap = (0, _Modifiers.createVectorizeColorsMap)({}, svgColors);
|
|
109
110
|
patchedImageData = _objectSpread(_objectSpread({}, imageData), {}, {
|
|
110
111
|
colorPreviewRequired: true,
|
|
111
112
|
displayColorPreview: true,
|
|
112
|
-
colorPreviewEnabled:
|
|
113
|
+
colorPreviewEnabled: !vectorizedLogoMandatory,
|
|
113
114
|
operations: _objectSpread(_objectSpread({}, imageData.operations), {}, {
|
|
114
115
|
vectorizeColorsMap: vectorizeColorsMap
|
|
115
116
|
})
|
|
116
117
|
});
|
|
117
|
-
_context.next =
|
|
118
|
+
_context.next = 18;
|
|
118
119
|
break;
|
|
119
120
|
|
|
120
|
-
case
|
|
121
|
+
case 17:
|
|
121
122
|
// the color replacement call returns the same url for every call, making the browser serve the image
|
|
122
123
|
// from cache, to force reloading a random query string has to be added to the url
|
|
123
124
|
patchedImageData = _objectSpread(_objectSpread({}, imageData), {}, {
|
|
@@ -126,11 +127,11 @@ var prepareImageData = function createImageDataPreProcessor() {
|
|
|
126
127
|
})
|
|
127
128
|
});
|
|
128
129
|
|
|
129
|
-
case
|
|
130
|
+
case 18:
|
|
130
131
|
imageDataMemo.set(designProductionMethod.identifier, patchedImageData);
|
|
131
132
|
return _context.abrupt("return", patchedImageData);
|
|
132
133
|
|
|
133
|
-
case
|
|
134
|
+
case 20:
|
|
134
135
|
case "end":
|
|
135
136
|
return _context.stop();
|
|
136
137
|
}
|