@configuratorware/configurator-frontendgui 1.44.10 → 1.45.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 +9 -5
- package/App/Reducers/Configurator/Actions.js +40 -34
- package/App/Reducers/ImageGallery/Actions.js +3 -2
- package/App/Reducers/ImageGallery/Modifiers.js +18 -11
- package/App/Reducers/ImageGallery/Reducer.js +3 -1
- package/App/Services/DesignDataService.js +91 -41
- package/App/Services/VisualizationService.js +3 -0
- package/App/Translations.js +13 -14
- package/App/configuration.js +1 -1
- package/package.json +4 -4
- package/src/App/Modules/Designer/Containers/ImageEditDialog.js +5 -3
- package/src/App/Reducers/Configurator/Actions.js +15 -7
- package/src/App/Reducers/ImageGallery/Actions.js +8 -4
- package/src/App/Reducers/ImageGallery/Modifiers.js +3 -4
- package/src/App/Reducers/ImageGallery/Reducer.js +9 -1
- package/src/App/Reducers/ImageGallery/__tests__/Actions.test.js +5 -6
- package/src/App/Services/DesignDataService.js +24 -0
- package/src/App/Services/VisualizationService.js +4 -0
- package/src/App/Translations.js +2 -8
- package/src/App/configuration.js +1 -1
|
@@ -469,7 +469,7 @@ var ImageEditDialogContainer = exports.ImageEditDialogContainer = /*#__PURE__*/f
|
|
|
469
469
|
});
|
|
470
470
|
_defineProperty(_assertThisInitialized(_this), "onSelectImage", /*#__PURE__*/function () {
|
|
471
471
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(file) {
|
|
472
|
-
var addGalleryImageToUserImages, imageUrl, thumbUrl, fileName, vectorizeColorsMap;
|
|
472
|
+
var addGalleryImageToUserImages, imageUrl, thumbUrl, fileName, vectorizeColorsMap, svgImageSize;
|
|
473
473
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
474
474
|
while (1) switch (_context7.prev = _context7.next) {
|
|
475
475
|
case 0:
|
|
@@ -481,11 +481,15 @@ var ImageEditDialogContainer = exports.ImageEditDialogContainer = /*#__PURE__*/f
|
|
|
481
481
|
return _ServiceLocator.Services.designData.getGalleryImageColors(imageUrl);
|
|
482
482
|
case 5:
|
|
483
483
|
vectorizeColorsMap = _context7.sent;
|
|
484
|
-
|
|
484
|
+
_context7.next = 8;
|
|
485
|
+
return _ServiceLocator.Services.designData.getSVGImageSize(imageUrl);
|
|
486
|
+
case 8:
|
|
487
|
+
svgImageSize = _context7.sent;
|
|
488
|
+
addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap, svgImageSize);
|
|
485
489
|
|
|
486
490
|
// exit image upload if a gallery image is selected
|
|
487
491
|
_this.setUpload(null);
|
|
488
|
-
case
|
|
492
|
+
case 11:
|
|
489
493
|
case "end":
|
|
490
494
|
return _context7.stop();
|
|
491
495
|
}
|
|
@@ -930,8 +934,8 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
930
934
|
setSelectedImage: function setSelectedImage(identifier) {
|
|
931
935
|
return dispatch((0, _Actions.setSelectedImageByIdentifier)(identifier));
|
|
932
936
|
},
|
|
933
|
-
addGalleryImageToUserImages: function addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap) {
|
|
934
|
-
return dispatch((0, _Actions.addGalleryImageToUserImages)(imageUrl, thumbUrl, fileName, vectorizeColorsMap));
|
|
937
|
+
addGalleryImageToUserImages: function addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap, svgImageSize) {
|
|
938
|
+
return dispatch((0, _Actions.addGalleryImageToUserImages)(imageUrl, thumbUrl, fileName, vectorizeColorsMap, svgImageSize));
|
|
935
939
|
},
|
|
936
940
|
shouldAddImageImmediately: function shouldAddImageImmediately(imageData) {
|
|
937
941
|
return (0, _Selectors3.isImageReadyToBeAdded)(_ServiceLocator.Services.store.state, imageData);
|
|
@@ -85,12 +85,11 @@ var receiveConfiguration = exports.receiveConfiguration = function receiveConfig
|
|
|
85
85
|
var checkValidation = _ref.checkValidation;
|
|
86
86
|
return /*#__PURE__*/function () {
|
|
87
87
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch, getState) {
|
|
88
|
-
var prevState,
|
|
88
|
+
var prevState, action, _getState, configurator, configuration, selectedoptionclassification, loadIdentifier, _getAvailableConfigur, designerEnabled, initialDesignData;
|
|
89
89
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
90
90
|
while (1) switch (_context.prev = _context.next) {
|
|
91
91
|
case 0:
|
|
92
92
|
prevState = getState();
|
|
93
|
-
selectOptions = (0, _configuration.getConf)('selectOptions');
|
|
94
93
|
dispatch(setCalculationEnabled(false));
|
|
95
94
|
if (checkValidation) {
|
|
96
95
|
dispatch(inspectValidationResults(json));
|
|
@@ -100,9 +99,6 @@ var receiveConfiguration = exports.receiveConfiguration = function receiveConfig
|
|
|
100
99
|
data: (0, _Modifiers.patchViewImages)(json),
|
|
101
100
|
receivedAt: Date.now()
|
|
102
101
|
});
|
|
103
|
-
if (selectOptions) {
|
|
104
|
-
dispatch(selectMultipleOptions(selectOptions));
|
|
105
|
-
}
|
|
106
102
|
dispatch(inspectCheckResults());
|
|
107
103
|
_getState = getState(), configurator = _getState.configurator;
|
|
108
104
|
configuration = configurator.configuration, selectedoptionclassification = configurator.selectedoptionclassification, loadIdentifier = configurator.loadIdentifier;
|
|
@@ -126,25 +122,25 @@ var receiveConfiguration = exports.receiveConfiguration = function receiveConfig
|
|
|
126
122
|
applyVariantAmountPreSelection(configurator);
|
|
127
123
|
setDefaultSelectedVariantIdentifier((0, _Selectors.getConfigurator)(getState()), loadIdentifier);
|
|
128
124
|
if (!designerEnabled) {
|
|
129
|
-
_context.next =
|
|
125
|
+
_context.next = 24;
|
|
130
126
|
break;
|
|
131
127
|
}
|
|
132
|
-
_context.next =
|
|
128
|
+
_context.next = 19;
|
|
133
129
|
return dispatch((0, _Actions3.fetchFonts)());
|
|
134
|
-
case
|
|
130
|
+
case 19:
|
|
135
131
|
dispatch((0, _Actions5.addCustomFonts)((0, _Selectors3.getUsedCustomFontsInEditor)(getState())));
|
|
136
|
-
_context.next =
|
|
132
|
+
_context.next = 22;
|
|
137
133
|
return dispatch(loadDesignerData((0, _Selectors.getConfiguration)((0, _Selectors.getConfigurator)(getState()))));
|
|
138
|
-
case
|
|
134
|
+
case 22:
|
|
139
135
|
initialDesignData = (0, _Transformers.createInitialDesignDataFromDesignAreas)((0, _get["default"])(getState(), 'designArea.filteredDesignAreas') || [], (0, _Reducer.getDesignData)((0, _Selectors.getConfigurator)(getState())));
|
|
140
136
|
dispatch((0, _Actions6.setInitialDesignData)(initialDesignData));
|
|
141
|
-
case
|
|
137
|
+
case 24:
|
|
142
138
|
// enable calculation and trigger it
|
|
143
139
|
dispatch(setCalculationEnabled(true));
|
|
144
140
|
dispatch(invalidateCalculation());
|
|
145
141
|
dispatch(doCalculation((0, _Selectors.getConfiguration)((0, _Selectors.getConfigurator)(getState()))));
|
|
146
142
|
return _context.abrupt("return", action);
|
|
147
|
-
case
|
|
143
|
+
case 28:
|
|
148
144
|
case "end":
|
|
149
145
|
return _context.stop();
|
|
150
146
|
}
|
|
@@ -512,7 +508,13 @@ var inspectValidationResults = exports.inspectValidationResults = function inspe
|
|
|
512
508
|
};
|
|
513
509
|
};
|
|
514
510
|
var fetchConfiguration = exports.fetchConfiguration = function fetchConfiguration(itemidentifier) {
|
|
515
|
-
|
|
511
|
+
var selectOptions = (0, _configuration.getConf)('selectOptions');
|
|
512
|
+
var urlToCall = "configuration/loadbyitemidentifier/".concat(itemidentifier);
|
|
513
|
+
if (selectOptions) {
|
|
514
|
+
var switchOptionData = JSON.stringify(getSwitchOptionData(selectOptions));
|
|
515
|
+
urlToCall = "".concat(urlToCall, "?_switch_options=").concat(switchOptionData);
|
|
516
|
+
}
|
|
517
|
+
return apiActions.fetchData(urlToCall, receiveConfiguration);
|
|
516
518
|
};
|
|
517
519
|
var fetchConfigurationByCode = exports.fetchConfigurationByCode = function fetchConfigurationByCode(code) {
|
|
518
520
|
var checkValidation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -845,30 +847,34 @@ var applyOptionInputText = exports.applyOptionInputText = function applyOptionIn
|
|
|
845
847
|
var selectMultipleOptions = exports.selectMultipleOptions = function selectMultipleOptions(optionsList) {
|
|
846
848
|
return function (dispatch, getState) {
|
|
847
849
|
var configuration = (0, _Selectors.getConfiguration)((0, _Selectors.getConfigurator)(getState()));
|
|
848
|
-
var switchOptionData =
|
|
849
|
-
var _iterator4 = _createForOfIteratorHelper(optionsList),
|
|
850
|
-
_step4;
|
|
851
|
-
try {
|
|
852
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
853
|
-
var component = _step4.value;
|
|
854
|
-
switchOptionData[component.identifier] = component.selectedoptions.map(function (_ref5) {
|
|
855
|
-
var identifier = _ref5.identifier,
|
|
856
|
-
amount = _ref5.amount;
|
|
857
|
-
return {
|
|
858
|
-
identifier: identifier,
|
|
859
|
-
amount: typeof amount === 'undefined' ? 1 : amount,
|
|
860
|
-
check_results: null
|
|
861
|
-
};
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
} catch (err) {
|
|
865
|
-
_iterator4.e(err);
|
|
866
|
-
} finally {
|
|
867
|
-
_iterator4.f();
|
|
868
|
-
}
|
|
850
|
+
var switchOptionData = getSwitchOptionData(optionsList);
|
|
869
851
|
return dispatch(switchOptions(configuration, switchOptionData, false, false, true));
|
|
870
852
|
};
|
|
871
853
|
};
|
|
854
|
+
var getSwitchOptionData = function getSwitchOptionData(optionsList) {
|
|
855
|
+
var switchOptionData = {};
|
|
856
|
+
var _iterator4 = _createForOfIteratorHelper(optionsList),
|
|
857
|
+
_step4;
|
|
858
|
+
try {
|
|
859
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
860
|
+
var component = _step4.value;
|
|
861
|
+
switchOptionData[component.identifier] = component.selectedoptions.map(function (_ref5) {
|
|
862
|
+
var identifier = _ref5.identifier,
|
|
863
|
+
amount = _ref5.amount;
|
|
864
|
+
return {
|
|
865
|
+
identifier: identifier,
|
|
866
|
+
amount: typeof amount === 'undefined' ? 1 : amount,
|
|
867
|
+
check_results: null
|
|
868
|
+
};
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
} catch (err) {
|
|
872
|
+
_iterator4.e(err);
|
|
873
|
+
} finally {
|
|
874
|
+
_iterator4.f();
|
|
875
|
+
}
|
|
876
|
+
return switchOptionData;
|
|
877
|
+
};
|
|
872
878
|
var viewOptionDetails = exports.viewOptionDetails = function viewOptionDetails(option) {
|
|
873
879
|
return function (dispatch, getState) {
|
|
874
880
|
if (!option) {
|
|
@@ -224,7 +224,7 @@ var commitChanges = exports.commitChanges = function commitChanges() {
|
|
|
224
224
|
});
|
|
225
225
|
};
|
|
226
226
|
};
|
|
227
|
-
var addGalleryImageToUserImages = exports.addGalleryImageToUserImages = function addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap) {
|
|
227
|
+
var addGalleryImageToUserImages = exports.addGalleryImageToUserImages = function addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap, svgImageSize) {
|
|
228
228
|
return function (dispatch, getState) {
|
|
229
229
|
var compatibilityInfoHash = (0, _Selectors2.getCurrentCompatibilityInfoHash)(getState());
|
|
230
230
|
return dispatch({
|
|
@@ -233,7 +233,8 @@ var addGalleryImageToUserImages = exports.addGalleryImageToUserImages = function
|
|
|
233
233
|
thumbUrl: thumbUrl,
|
|
234
234
|
fileName: fileName,
|
|
235
235
|
vectorizeColorsMap: vectorizeColorsMap,
|
|
236
|
-
compatibilityInfoHash: compatibilityInfoHash
|
|
236
|
+
compatibilityInfoHash: compatibilityInfoHash,
|
|
237
|
+
svgImageSize: svgImageSize
|
|
237
238
|
});
|
|
238
239
|
};
|
|
239
240
|
};
|
|
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.generateImageId = exports.createTextPlaceholder = exports.createSVGImageData = void 0;
|
|
7
7
|
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
15
|
var createTextPlaceholder = exports.createTextPlaceholder = function createTextPlaceholder(content) {
|
|
10
16
|
return "<span data-placeholder=\"true\">".concat(content, "</span>");
|
|
11
17
|
};
|
|
@@ -22,25 +28,26 @@ var createSVGImageData = exports.createSVGImageData = function createSVGImageDat
|
|
|
22
28
|
_options$galleryImage = options.galleryImage,
|
|
23
29
|
galleryImage = _options$galleryImage === void 0 ? true : _options$galleryImage,
|
|
24
30
|
_options$isPlaceHolde = options.isPlaceHolderImage,
|
|
25
|
-
isPlaceHolderImage = _options$isPlaceHolde === void 0 ? false : _options$isPlaceHolde
|
|
31
|
+
isPlaceHolderImage = _options$isPlaceHolde === void 0 ? false : _options$isPlaceHolde,
|
|
32
|
+
_options$svgImageSize = options.svgImageSize,
|
|
33
|
+
svgImageSize = _options$svgImageSize === void 0 ? {
|
|
34
|
+
width: 290,
|
|
35
|
+
height: 290
|
|
36
|
+
} : _options$svgImageSize;
|
|
26
37
|
return {
|
|
27
38
|
fileName: fileName,
|
|
28
39
|
identifier: generateImageId(),
|
|
29
40
|
originalFileName: imageUrl,
|
|
30
|
-
original: {
|
|
41
|
+
original: _objectSpread({
|
|
31
42
|
url: null,
|
|
32
43
|
format: 'SVG',
|
|
33
|
-
mimeType: 'image/svg+xml'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
preview: {
|
|
44
|
+
mimeType: 'image/svg+xml'
|
|
45
|
+
}, svgImageSize),
|
|
46
|
+
preview: _objectSpread({
|
|
38
47
|
url: imageUrl,
|
|
39
48
|
format: 'SVG',
|
|
40
|
-
mimeType: 'image/svg+xml'
|
|
41
|
-
|
|
42
|
-
height: 290
|
|
43
|
-
},
|
|
49
|
+
mimeType: 'image/svg+xml'
|
|
50
|
+
}, svgImageSize),
|
|
44
51
|
thumbnail: {
|
|
45
52
|
url: thumbUrl,
|
|
46
53
|
format: 'PNG',
|
|
@@ -231,11 +231,13 @@ function imageGalleryReducer() {
|
|
|
231
231
|
thumbUrl = action.thumbUrl,
|
|
232
232
|
_fileName2 = action.fileName,
|
|
233
233
|
vectorizeColorsMap = action.vectorizeColorsMap,
|
|
234
|
-
_compatibilityInfoHash = action.compatibilityInfoHash
|
|
234
|
+
_compatibilityInfoHash = action.compatibilityInfoHash,
|
|
235
|
+
svgImageSize = action.svgImageSize;
|
|
235
236
|
var _image = (0, _Modifiers.createSVGImageData)({
|
|
236
237
|
imageUrl: imageUrl,
|
|
237
238
|
thumbUrl: thumbUrl,
|
|
238
239
|
fileName: _fileName2,
|
|
240
|
+
svgImageSize: svgImageSize,
|
|
239
241
|
operations: {
|
|
240
242
|
vectorizeColorsMap: vectorizeColorsMap
|
|
241
243
|
}
|
|
@@ -2473,6 +2473,56 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2473
2473
|
}
|
|
2474
2474
|
return getGalleryImageColors;
|
|
2475
2475
|
}()
|
|
2476
|
+
}, {
|
|
2477
|
+
key: "getSVGImageSize",
|
|
2478
|
+
value: function () {
|
|
2479
|
+
var _getSVGImageSize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(url) {
|
|
2480
|
+
var _svgContent$match, _svgContent$match2, _svgContent$match3, _svgTag$match;
|
|
2481
|
+
var svgContent, svgTag, width, height, viewBoxValues;
|
|
2482
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context34) {
|
|
2483
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2484
|
+
case 0:
|
|
2485
|
+
_context34.next = 2;
|
|
2486
|
+
return getSvgContent(url);
|
|
2487
|
+
case 2:
|
|
2488
|
+
svgContent = _context34.sent;
|
|
2489
|
+
svgTag = (_svgContent$match = svgContent.match(/<svg[^>]+>/)) === null || _svgContent$match === void 0 ? void 0 : _svgContent$match[0];
|
|
2490
|
+
width = (_svgContent$match2 = svgContent.match(/width="([^"]+)"/)) === null || _svgContent$match2 === void 0 ? void 0 : _svgContent$match2[1];
|
|
2491
|
+
height = (_svgContent$match3 = svgContent.match(/height="([^"]+)"/)) === null || _svgContent$match3 === void 0 ? void 0 : _svgContent$match3[1];
|
|
2492
|
+
if (!(width && height)) {
|
|
2493
|
+
_context34.next = 8;
|
|
2494
|
+
break;
|
|
2495
|
+
}
|
|
2496
|
+
return _context34.abrupt("return", {
|
|
2497
|
+
width: parseFloat(width),
|
|
2498
|
+
height: parseFloat(height)
|
|
2499
|
+
});
|
|
2500
|
+
case 8:
|
|
2501
|
+
viewBoxValues = (_svgTag$match = svgTag.match(/viewBox="([^"]+)"/)) === null || _svgTag$match === void 0 || (_svgTag$match = _svgTag$match[1]) === null || _svgTag$match === void 0 ? void 0 : _svgTag$match.split(' ');
|
|
2502
|
+
if (!(viewBoxValues.length === 4)) {
|
|
2503
|
+
_context34.next = 11;
|
|
2504
|
+
break;
|
|
2505
|
+
}
|
|
2506
|
+
return _context34.abrupt("return", {
|
|
2507
|
+
width: parseFloat(viewBoxValues[2]),
|
|
2508
|
+
height: parseFloat(viewBoxValues[3])
|
|
2509
|
+
});
|
|
2510
|
+
case 11:
|
|
2511
|
+
return _context34.abrupt("return", {
|
|
2512
|
+
width: 300,
|
|
2513
|
+
height: 300
|
|
2514
|
+
});
|
|
2515
|
+
case 12:
|
|
2516
|
+
case "end":
|
|
2517
|
+
return _context34.stop();
|
|
2518
|
+
}
|
|
2519
|
+
}, _callee33);
|
|
2520
|
+
}));
|
|
2521
|
+
function getSVGImageSize(_x36) {
|
|
2522
|
+
return _getSVGImageSize.apply(this, arguments);
|
|
2523
|
+
}
|
|
2524
|
+
return getSVGImageSize;
|
|
2525
|
+
}()
|
|
2476
2526
|
}, {
|
|
2477
2527
|
key: "updateDesignAreaImagesWithSelectedImageData",
|
|
2478
2528
|
value: function updateDesignAreaImagesWithSelectedImageData() {
|
|
@@ -2493,34 +2543,34 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2493
2543
|
}, {
|
|
2494
2544
|
key: "editFileQueued",
|
|
2495
2545
|
value: function () {
|
|
2496
|
-
var _editFileQueued = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2546
|
+
var _editFileQueued = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(operations, image) {
|
|
2497
2547
|
var options,
|
|
2498
2548
|
releaseLock,
|
|
2499
|
-
|
|
2500
|
-
return _regeneratorRuntime().wrap(function
|
|
2501
|
-
while (1) switch (
|
|
2549
|
+
_args35 = arguments;
|
|
2550
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context35) {
|
|
2551
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2502
2552
|
case 0:
|
|
2503
|
-
options =
|
|
2504
|
-
|
|
2553
|
+
options = _args35.length > 2 && _args35[2] !== undefined ? _args35[2] : {};
|
|
2554
|
+
_context35.next = 3;
|
|
2505
2555
|
return (0, _ObjectLock.requestLock)(this);
|
|
2506
2556
|
case 3:
|
|
2507
|
-
releaseLock =
|
|
2508
|
-
|
|
2509
|
-
|
|
2557
|
+
releaseLock = _context35.sent;
|
|
2558
|
+
_context35.prev = 4;
|
|
2559
|
+
_context35.next = 7;
|
|
2510
2560
|
return this.editFile(operations, image, options);
|
|
2511
2561
|
case 7:
|
|
2512
|
-
return
|
|
2562
|
+
return _context35.abrupt("return", _context35.sent);
|
|
2513
2563
|
case 8:
|
|
2514
|
-
|
|
2564
|
+
_context35.prev = 8;
|
|
2515
2565
|
releaseLock();
|
|
2516
|
-
return
|
|
2566
|
+
return _context35.finish(8);
|
|
2517
2567
|
case 11:
|
|
2518
2568
|
case "end":
|
|
2519
|
-
return
|
|
2569
|
+
return _context35.stop();
|
|
2520
2570
|
}
|
|
2521
|
-
},
|
|
2571
|
+
}, _callee34, this, [[4,, 8, 11]]);
|
|
2522
2572
|
}));
|
|
2523
|
-
function editFileQueued(
|
|
2573
|
+
function editFileQueued(_x37, _x38) {
|
|
2524
2574
|
return _editFileQueued.apply(this, arguments);
|
|
2525
2575
|
}
|
|
2526
2576
|
return editFileQueued;
|
|
@@ -2528,7 +2578,7 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2528
2578
|
}, {
|
|
2529
2579
|
key: "editFile",
|
|
2530
2580
|
value: function () {
|
|
2531
|
-
var _editFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2581
|
+
var _editFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(operations, image) {
|
|
2532
2582
|
var options,
|
|
2533
2583
|
_options$immediateCom,
|
|
2534
2584
|
immediateCommit,
|
|
@@ -2562,11 +2612,11 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2562
2612
|
vectorizeOriginalColorsMap,
|
|
2563
2613
|
numberOfAggregatedColors,
|
|
2564
2614
|
numberOfColorsToRemove,
|
|
2565
|
-
|
|
2566
|
-
return _regeneratorRuntime().wrap(function
|
|
2567
|
-
while (1) switch (
|
|
2615
|
+
_args36 = arguments;
|
|
2616
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context36) {
|
|
2617
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2568
2618
|
case 0:
|
|
2569
|
-
options =
|
|
2619
|
+
options = _args36.length > 2 && _args36[2] !== undefined ? _args36[2] : {};
|
|
2570
2620
|
// patch operations to keep other unchanged values
|
|
2571
2621
|
operations = _objectSpread(_objectSpread({}, image.operations), operations);
|
|
2572
2622
|
_options$immediateCom = options.immediateCommit, immediateCommit = _options$immediateCom === void 0 ? false : _options$immediateCom, _options$designProduc = options.designProductionMethod, designProductionMethod = _options$designProduc === void 0 ? (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state) : _options$designProduc, _options$addMode = options.addMode, addMode = _options$addMode === void 0 ? false : _options$addMode, displayColorPreview = options.displayColorPreview;
|
|
@@ -2585,7 +2635,7 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2585
2635
|
displayColorPreview: displayColorPreview
|
|
2586
2636
|
});
|
|
2587
2637
|
if (!(!operationsMatching || !imageIsCompatible)) {
|
|
2588
|
-
|
|
2638
|
+
_context36.next = 29;
|
|
2589
2639
|
break;
|
|
2590
2640
|
}
|
|
2591
2641
|
if (!image.operations) {
|
|
@@ -2593,13 +2643,13 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2593
2643
|
}
|
|
2594
2644
|
operations = makeOperationsCompatible(operations, compatibilityInfoHash, designProductionMethod.colorPalettes);
|
|
2595
2645
|
if (!image.gallery) {
|
|
2596
|
-
|
|
2646
|
+
_context36.next = 18;
|
|
2597
2647
|
break;
|
|
2598
2648
|
}
|
|
2599
2649
|
operations = _objectSpread(_objectSpread({}, operations || {}), {}, {
|
|
2600
2650
|
vectorizeColorsMap: operations.vectorizeColorsMap
|
|
2601
2651
|
});
|
|
2602
|
-
|
|
2652
|
+
_context36.next = 29;
|
|
2603
2653
|
break;
|
|
2604
2654
|
case 18:
|
|
2605
2655
|
_getImageUsageInfo = (0, _Selectors2.getImageUsageInfo)(_ServiceLocator.Services.store.state, image.identifier), designAreas = _getImageUsageInfo.designAreas, count = _getImageUsageInfo.count;
|
|
@@ -2608,10 +2658,10 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2608
2658
|
currentEditData = (0, _Modifiers.getEditDataFromOperations)(image.fileName, image.operations || {}, designProductionMethod);
|
|
2609
2659
|
isBackendNeeded = createCopy || !(0, _isEqual["default"])(editData, currentEditData);
|
|
2610
2660
|
if (!isBackendNeeded) {
|
|
2611
|
-
|
|
2661
|
+
_context36.next = 29;
|
|
2612
2662
|
break;
|
|
2613
2663
|
}
|
|
2614
|
-
|
|
2664
|
+
_context36.next = 26;
|
|
2615
2665
|
return _ServiceLocator.Services.store.dispatch((0, _Actions2.editImage)(_objectSpread(_objectSpread({}, editData), {}, {
|
|
2616
2666
|
createCopy: createCopy
|
|
2617
2667
|
}), _objectSpread(_objectSpread({}, imageDataPatch), {}, {
|
|
@@ -2627,20 +2677,20 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2627
2677
|
imageIdentifier = (0, _get2["default"])(selectedImage, 'identifier');
|
|
2628
2678
|
case 29:
|
|
2629
2679
|
if (!(!preview || !preview.url)) {
|
|
2630
|
-
|
|
2680
|
+
_context36.next = 31;
|
|
2631
2681
|
break;
|
|
2632
2682
|
}
|
|
2633
2683
|
throw new Error('Preview image url is not specified!');
|
|
2634
2684
|
case 31:
|
|
2635
2685
|
if (!(0, _Selectors2.isEditableVectorImage)(preview)) {
|
|
2636
|
-
|
|
2686
|
+
_context36.next = 40;
|
|
2637
2687
|
break;
|
|
2638
2688
|
}
|
|
2639
2689
|
_designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state);
|
|
2640
|
-
|
|
2690
|
+
_context36.next = 35;
|
|
2641
2691
|
return getSvgContent(preview.url, false, !operationsMatching);
|
|
2642
2692
|
case 35:
|
|
2643
|
-
svgContent =
|
|
2693
|
+
svgContent = _context36.sent;
|
|
2644
2694
|
svgColors = getSvgColors(svgContent, _designProductionMethod);
|
|
2645
2695
|
vectorizeColorsMap = (0, _Modifiers.createVectorizeColorsMap)(operations.vectorizeColorsMap, svgColors);
|
|
2646
2696
|
thresholdChanged = operations.vectorizeThreshold !== (0, _get2["default"])(image, 'operations.vectorizeThreshold', 0); // prepare initial values for the vectorize feature
|
|
@@ -2678,7 +2728,7 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2678
2728
|
if (immediateCommit) {
|
|
2679
2729
|
this.updateDesignAreaImagesWithSelectedImageData(image.identifier);
|
|
2680
2730
|
}
|
|
2681
|
-
return
|
|
2731
|
+
return _context36.abrupt("return", {
|
|
2682
2732
|
vectorizeColorsMap: operations.vectorizeColorsMap,
|
|
2683
2733
|
vectorizeThreshold: operations.vectorizeThreshold,
|
|
2684
2734
|
vectorizeMaxColorAmount: operations.vectorizeMaxColorAmount,
|
|
@@ -2686,11 +2736,11 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2686
2736
|
});
|
|
2687
2737
|
case 43:
|
|
2688
2738
|
case "end":
|
|
2689
|
-
return
|
|
2739
|
+
return _context36.stop();
|
|
2690
2740
|
}
|
|
2691
|
-
},
|
|
2741
|
+
}, _callee35, this);
|
|
2692
2742
|
}));
|
|
2693
|
-
function editFile(
|
|
2743
|
+
function editFile(_x39, _x40) {
|
|
2694
2744
|
return _editFile.apply(this, arguments);
|
|
2695
2745
|
}
|
|
2696
2746
|
return editFile;
|
|
@@ -2698,10 +2748,10 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2698
2748
|
}, {
|
|
2699
2749
|
key: "resetEditedFile",
|
|
2700
2750
|
value: function () {
|
|
2701
|
-
var _resetEditedFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2751
|
+
var _resetEditedFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(image) {
|
|
2702
2752
|
var state, _image, operations, vectorizeColorsMap, resetOperations, designProductionMethod;
|
|
2703
|
-
return _regeneratorRuntime().wrap(function
|
|
2704
|
-
while (1) switch (
|
|
2753
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context37) {
|
|
2754
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2705
2755
|
case 0:
|
|
2706
2756
|
state = _ServiceLocator.Services.store.state;
|
|
2707
2757
|
if (!image) {
|
|
@@ -2720,17 +2770,17 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2720
2770
|
vectorizeThreshold: null
|
|
2721
2771
|
});
|
|
2722
2772
|
}
|
|
2723
|
-
|
|
2773
|
+
_context37.next = 7;
|
|
2724
2774
|
return this.editFileQueued(resetOperations, image);
|
|
2725
2775
|
case 7:
|
|
2726
|
-
return
|
|
2776
|
+
return _context37.abrupt("return", _context37.sent);
|
|
2727
2777
|
case 8:
|
|
2728
2778
|
case "end":
|
|
2729
|
-
return
|
|
2779
|
+
return _context37.stop();
|
|
2730
2780
|
}
|
|
2731
|
-
},
|
|
2781
|
+
}, _callee36, this);
|
|
2732
2782
|
}));
|
|
2733
|
-
function resetEditedFile(
|
|
2783
|
+
function resetEditedFile(_x41) {
|
|
2734
2784
|
return _resetEditedFile.apply(this, arguments);
|
|
2735
2785
|
}
|
|
2736
2786
|
return resetEditedFile;
|
|
@@ -339,6 +339,9 @@ var VisualizationService = exports["default"] = /*#__PURE__*/function (_Abstract
|
|
|
339
339
|
component.observable.on(_Constants.EventTypes.Error, function () {
|
|
340
340
|
_ServiceLocator.Services.ui.reportError((0, _i18n.t)('visualization.errors.visualizationNotPossible'));
|
|
341
341
|
});
|
|
342
|
+
component.observable.on(_Constants.EventTypes.EmptySceneError, function () {
|
|
343
|
+
_ServiceLocator.Services.ui.reportError((0, _i18n.t)('visualization.errors.visualizationNotPossible'));
|
|
344
|
+
});
|
|
342
345
|
|
|
343
346
|
// in dev mode expose the three object to the window
|
|
344
347
|
if (!(0, _configuration.isProduction)()) {
|
package/App/Translations.js
CHANGED
|
@@ -10,38 +10,37 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
10
10
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
11
11
|
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); } }
|
|
12
12
|
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); }); }; }
|
|
13
|
-
function initLanguage(_x) {
|
|
13
|
+
function initLanguage(_x, _x2) {
|
|
14
14
|
return _initLanguage.apply(this, arguments);
|
|
15
15
|
}
|
|
16
16
|
function _initLanguage() {
|
|
17
|
-
_initLanguage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(lang) {
|
|
18
|
-
var fileKey, langKey,
|
|
17
|
+
_initLanguage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(lang, baseURL) {
|
|
18
|
+
var fileKey, langKey, results;
|
|
19
19
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
22
|
// ensure that the filename always has an underscore and no dash
|
|
23
23
|
fileKey = lang.replace('-', '_');
|
|
24
24
|
langKey = lang.substring(0, 2);
|
|
25
|
-
cachedTranslationsDomain = 'messages.';
|
|
26
25
|
if (!(0, _configuration.isProduction)()) {
|
|
27
|
-
_context.next =
|
|
26
|
+
_context.next = 8;
|
|
28
27
|
break;
|
|
29
28
|
}
|
|
30
|
-
_context.next =
|
|
31
|
-
return Promise.all([loadLanguageJson(
|
|
32
|
-
case
|
|
29
|
+
_context.next = 5;
|
|
30
|
+
return Promise.all([loadLanguageJson("".concat(baseURL, "translations/frontend/").concat(fileKey), langKey)]);
|
|
31
|
+
case 5:
|
|
33
32
|
_context.t0 = _context.sent;
|
|
34
|
-
_context.next = 12;
|
|
35
|
-
break;
|
|
36
|
-
case 9:
|
|
37
33
|
_context.next = 11;
|
|
34
|
+
break;
|
|
35
|
+
case 8:
|
|
36
|
+
_context.next = 10;
|
|
38
37
|
return Promise.all([loadLanguageJson('/translations/' + fileKey + '.json', langKey), loadLanguageJson('/translations_custom/' + fileKey + '.json', langKey)]);
|
|
39
|
-
case
|
|
38
|
+
case 10:
|
|
40
39
|
_context.t0 = _context.sent;
|
|
41
|
-
case
|
|
40
|
+
case 11:
|
|
42
41
|
results = _context.t0;
|
|
43
42
|
results.forEach(_i18n.use);
|
|
44
|
-
case
|
|
43
|
+
case 13:
|
|
45
44
|
case "end":
|
|
46
45
|
return _context.stop();
|
|
47
46
|
}
|
package/App/configuration.js
CHANGED
|
@@ -397,7 +397,7 @@ function setLanguage() {
|
|
|
397
397
|
}
|
|
398
398
|
applicationConfiguration.language = language.replace('_', '-');
|
|
399
399
|
_Api["default"].setLanguage(applicationConfiguration.language);
|
|
400
|
-
(0, _Translations.initLanguage)(applicationConfiguration.language);
|
|
400
|
+
(0, _Translations.initLanguage)(applicationConfiguration.language, applicationConfiguration.network.baseURL);
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
// backward compatibility alias
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-frontendgui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/polyfill": "^7.12.1",
|
|
9
|
-
"@configuratorware/scripts": "1.
|
|
9
|
+
"@configuratorware/scripts": "1.45.0",
|
|
10
10
|
"@material-ui/core": "^4.12.4",
|
|
11
11
|
"@material-ui/icons": "^4.11.3",
|
|
12
12
|
"@material-ui/lab": "^4.0.0-alpha.61",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"react-router-dom": "^5.3.4",
|
|
37
37
|
"react-swipeable": "^5.5.1",
|
|
38
38
|
"react-zoom-pan-pinch": "^2.1.3",
|
|
39
|
-
"redhotmagma-graphics-editor": "1.
|
|
40
|
-
"redhotmagma-visualization": "1.
|
|
39
|
+
"redhotmagma-graphics-editor": "1.45.0",
|
|
40
|
+
"redhotmagma-visualization": "1.45.0",
|
|
41
41
|
"redux": "^4.1.0",
|
|
42
42
|
"redux-logger": "^3.0.6",
|
|
43
43
|
"redux-persist": "^5.10.0",
|
|
@@ -562,7 +562,9 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
562
562
|
|
|
563
563
|
const vectorizeColorsMap = await Services.designData.getGalleryImageColors(imageUrl);
|
|
564
564
|
|
|
565
|
-
|
|
565
|
+
const svgImageSize = await Services.designData.getSVGImageSize(imageUrl);
|
|
566
|
+
|
|
567
|
+
addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap, svgImageSize);
|
|
566
568
|
|
|
567
569
|
// exit image upload if a gallery image is selected
|
|
568
570
|
this.setUpload(null);
|
|
@@ -864,8 +866,8 @@ const mapDispatchToProps = dispatch => ({
|
|
|
864
866
|
...options,
|
|
865
867
|
}),
|
|
866
868
|
setSelectedImage: identifier => dispatch(setSelectedImageByIdentifier(identifier)),
|
|
867
|
-
addGalleryImageToUserImages: (imageUrl, thumbUrl, fileName, vectorizeColorsMap) =>
|
|
868
|
-
dispatch(addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap)),
|
|
869
|
+
addGalleryImageToUserImages: (imageUrl, thumbUrl, fileName, vectorizeColorsMap, svgImageSize) =>
|
|
870
|
+
dispatch(addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap, svgImageSize)),
|
|
869
871
|
shouldAddImageImmediately: imageData => isImageReadyToBeAdded(Services.store.state, imageData),
|
|
870
872
|
isColorMappingCompatible: vectorizeColorsMap =>
|
|
871
873
|
isColorMappingCompatible(
|
|
@@ -78,7 +78,6 @@ export const DELETE_SELECTED_AMOUNTS = 'DELETE_SELECTED_AMOUNTS';
|
|
|
78
78
|
|
|
79
79
|
export const receiveConfiguration = (json, { checkValidation }) => async (dispatch, getState) => {
|
|
80
80
|
const prevState = getState();
|
|
81
|
-
const selectOptions = getConf('selectOptions');
|
|
82
81
|
|
|
83
82
|
dispatch(setCalculationEnabled(false));
|
|
84
83
|
|
|
@@ -92,10 +91,6 @@ export const receiveConfiguration = (json, { checkValidation }) => async (dispat
|
|
|
92
91
|
receivedAt: Date.now(),
|
|
93
92
|
});
|
|
94
93
|
|
|
95
|
-
if (selectOptions) {
|
|
96
|
-
dispatch(selectMultipleOptions(selectOptions));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
94
|
dispatch(inspectCheckResults());
|
|
100
95
|
|
|
101
96
|
const { configurator } = getState();
|
|
@@ -462,7 +457,14 @@ export const inspectValidationResults = configuration => dispatch => {
|
|
|
462
457
|
};
|
|
463
458
|
|
|
464
459
|
export const fetchConfiguration = itemidentifier => {
|
|
465
|
-
|
|
460
|
+
const selectOptions = getConf('selectOptions');
|
|
461
|
+
let urlToCall = `configuration/loadbyitemidentifier/${itemidentifier}`;
|
|
462
|
+
if (selectOptions) {
|
|
463
|
+
const switchOptionData = JSON.stringify(getSwitchOptionData(selectOptions));
|
|
464
|
+
urlToCall = `${urlToCall}?_switch_options=${switchOptionData}`;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return apiActions.fetchData(urlToCall, receiveConfiguration);
|
|
466
468
|
};
|
|
467
469
|
|
|
468
470
|
export const fetchConfigurationByCode = (code, checkValidation = true) => {
|
|
@@ -783,6 +785,11 @@ export const applyOptionInputText = optionClassification => (dispatch, getState)
|
|
|
783
785
|
|
|
784
786
|
export const selectMultipleOptions = optionsList => (dispatch, getState) => {
|
|
785
787
|
const configuration = getConfiguration(getConfigurator(getState()));
|
|
788
|
+
const switchOptionData = getSwitchOptionData(optionsList);
|
|
789
|
+
return dispatch(switchOptions(configuration, switchOptionData, false, false, true));
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
const getSwitchOptionData = optionsList => {
|
|
786
793
|
const switchOptionData = {};
|
|
787
794
|
for (const component of optionsList) {
|
|
788
795
|
switchOptionData[component.identifier] = component.selectedoptions.map(({ identifier, amount }) => ({
|
|
@@ -791,7 +798,8 @@ export const selectMultipleOptions = optionsList => (dispatch, getState) => {
|
|
|
791
798
|
check_results: null,
|
|
792
799
|
}));
|
|
793
800
|
}
|
|
794
|
-
|
|
801
|
+
|
|
802
|
+
return switchOptionData;
|
|
795
803
|
};
|
|
796
804
|
|
|
797
805
|
export const viewOptionDetails = option => (dispatch, getState) => {
|
|
@@ -182,10 +182,13 @@ export const commitChanges = () => (dispatch, getState) => {
|
|
|
182
182
|
});
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
export const addGalleryImageToUserImages = (
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
export const addGalleryImageToUserImages = (
|
|
186
|
+
imageUrl,
|
|
187
|
+
thumbUrl,
|
|
188
|
+
fileName,
|
|
189
|
+
vectorizeColorsMap,
|
|
190
|
+
svgImageSize
|
|
191
|
+
) => (dispatch, getState) => {
|
|
189
192
|
const compatibilityInfoHash = getCurrentCompatibilityInfoHash(getState());
|
|
190
193
|
return dispatch({
|
|
191
194
|
type: ADD_GALLERY_IMAGE_TO_USER_IMAGES,
|
|
@@ -194,6 +197,7 @@ export const addGalleryImageToUserImages = (imageUrl, thumbUrl, fileName, vector
|
|
|
194
197
|
fileName,
|
|
195
198
|
vectorizeColorsMap,
|
|
196
199
|
compatibilityInfoHash,
|
|
200
|
+
svgImageSize,
|
|
197
201
|
});
|
|
198
202
|
};
|
|
199
203
|
|
|
@@ -12,6 +12,7 @@ export const createSVGImageData = (options = {}) => {
|
|
|
12
12
|
operations = {},
|
|
13
13
|
galleryImage = true,
|
|
14
14
|
isPlaceHolderImage = false,
|
|
15
|
+
svgImageSize = { width: 290, height: 290 },
|
|
15
16
|
} = options;
|
|
16
17
|
return {
|
|
17
18
|
fileName,
|
|
@@ -21,15 +22,13 @@ export const createSVGImageData = (options = {}) => {
|
|
|
21
22
|
url: null,
|
|
22
23
|
format: 'SVG',
|
|
23
24
|
mimeType: 'image/svg+xml',
|
|
24
|
-
|
|
25
|
-
height: 290,
|
|
25
|
+
...svgImageSize,
|
|
26
26
|
},
|
|
27
27
|
preview: {
|
|
28
28
|
url: imageUrl,
|
|
29
29
|
format: 'SVG',
|
|
30
30
|
mimeType: 'image/svg+xml',
|
|
31
|
-
|
|
32
|
-
height: 290,
|
|
31
|
+
...svgImageSize,
|
|
33
32
|
},
|
|
34
33
|
thumbnail: {
|
|
35
34
|
url: thumbUrl,
|
|
@@ -238,12 +238,20 @@ export function imageGalleryReducer(state = initialState, action = {}) {
|
|
|
238
238
|
return result;
|
|
239
239
|
}
|
|
240
240
|
case actionTypes.ADD_GALLERY_IMAGE_TO_USER_IMAGES: {
|
|
241
|
-
const {
|
|
241
|
+
const {
|
|
242
|
+
imageUrl,
|
|
243
|
+
thumbUrl,
|
|
244
|
+
fileName,
|
|
245
|
+
vectorizeColorsMap,
|
|
246
|
+
compatibilityInfoHash,
|
|
247
|
+
svgImageSize,
|
|
248
|
+
} = action;
|
|
242
249
|
|
|
243
250
|
const image = createSVGImageData({
|
|
244
251
|
imageUrl,
|
|
245
252
|
thumbUrl,
|
|
246
253
|
fileName,
|
|
254
|
+
svgImageSize,
|
|
247
255
|
operations: {
|
|
248
256
|
vectorizeColorsMap,
|
|
249
257
|
},
|
|
@@ -280,12 +280,10 @@ describe('Reducers/ImageGallery/Actions', () => {
|
|
|
280
280
|
},
|
|
281
281
|
});
|
|
282
282
|
|
|
283
|
-
const action = addGalleryImageToUserImages(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
vectorizeColorsMap
|
|
288
|
-
)(dispatch, getState);
|
|
283
|
+
const action = addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap, {
|
|
284
|
+
width: 300,
|
|
285
|
+
height: 150,
|
|
286
|
+
})(dispatch, getState);
|
|
289
287
|
|
|
290
288
|
expect(action).toEqual({
|
|
291
289
|
type: ADD_GALLERY_IMAGE_TO_USER_IMAGES,
|
|
@@ -299,6 +297,7 @@ describe('Reducers/ImageGallery/Actions', () => {
|
|
|
299
297
|
vectorsRequired: true,
|
|
300
298
|
colorPalettes: ['default'],
|
|
301
299
|
},
|
|
300
|
+
svgImageSize: { width: 300, height: 150 },
|
|
302
301
|
});
|
|
303
302
|
});
|
|
304
303
|
|
|
@@ -1895,6 +1895,30 @@ export default class DesignDataService {
|
|
|
1895
1895
|
return createVectorizeColorsMap({}, getSvgColors(svgContent, designProductionMethod));
|
|
1896
1896
|
}
|
|
1897
1897
|
|
|
1898
|
+
async getSVGImageSize(url) {
|
|
1899
|
+
const svgContent = await getSvgContent(url);
|
|
1900
|
+
const svgTag = svgContent.match(/<svg[^>]+>/)?.[0];
|
|
1901
|
+
const width = svgContent.match(/width="([^"]+)"/)?.[1];
|
|
1902
|
+
const height = svgContent.match(/height="([^"]+)"/)?.[1];
|
|
1903
|
+
if (width && height) {
|
|
1904
|
+
return {
|
|
1905
|
+
width: parseFloat(width),
|
|
1906
|
+
height: parseFloat(height),
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
const viewBoxValues = svgTag.match(/viewBox="([^"]+)"/)?.[1]?.split(' ');
|
|
1910
|
+
if (viewBoxValues.length === 4) {
|
|
1911
|
+
return {
|
|
1912
|
+
width: parseFloat(viewBoxValues[2]),
|
|
1913
|
+
height: parseFloat(viewBoxValues[3]),
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1916
|
+
return {
|
|
1917
|
+
width: 300,
|
|
1918
|
+
height: 300,
|
|
1919
|
+
};
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1898
1922
|
updateDesignAreaImagesWithSelectedImageData(originalImageIdentifier = '') {
|
|
1899
1923
|
const imageIdentifier = get(Services.store.state, 'imageGallery.selectedImage.identifier');
|
|
1900
1924
|
const newImage = find(Services.store.state.imageGallery.userImages, {
|
|
@@ -246,6 +246,10 @@ export default class VisualizationService extends AbstractVisualizationService {
|
|
|
246
246
|
Services.ui.reportError(t('visualization.errors.visualizationNotPossible'));
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
+
component.observable.on(VisualizationEventTypes.EmptySceneError, () => {
|
|
250
|
+
Services.ui.reportError(t('visualization.errors.visualizationNotPossible'));
|
|
251
|
+
});
|
|
252
|
+
|
|
249
253
|
// in dev mode expose the three object to the window
|
|
250
254
|
if (!isProduction()) {
|
|
251
255
|
window.visualization = component;
|
package/src/App/Translations.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { use } from 'Framework/i18n';
|
|
2
2
|
import { isProduction } from './configuration';
|
|
3
|
-
export async function initLanguage(lang) {
|
|
3
|
+
export async function initLanguage(lang, baseURL) {
|
|
4
4
|
// ensure that the filename always has an underscore and no dash
|
|
5
5
|
const fileKey = lang.replace('-', '_');
|
|
6
6
|
const langKey = lang.substring(0, 2);
|
|
7
|
-
const cachedTranslationsDomain = 'messages.';
|
|
8
7
|
|
|
9
8
|
const results = isProduction()
|
|
10
|
-
? await Promise.all([
|
|
11
|
-
loadLanguageJson(
|
|
12
|
-
'/translations_cached/' + cachedTranslationsDomain + fileKey + '.json',
|
|
13
|
-
langKey
|
|
14
|
-
),
|
|
15
|
-
])
|
|
9
|
+
? await Promise.all([loadLanguageJson(`${baseURL}translations/frontend/${fileKey}`, langKey)])
|
|
16
10
|
: await Promise.all([
|
|
17
11
|
loadLanguageJson('/translations/' + fileKey + '.json', langKey),
|
|
18
12
|
loadLanguageJson('/translations_custom/' + fileKey + '.json', langKey),
|
package/src/App/configuration.js
CHANGED
|
@@ -437,7 +437,7 @@ function setLanguage() {
|
|
|
437
437
|
}
|
|
438
438
|
applicationConfiguration.language = language.replace('_', '-');
|
|
439
439
|
Api.setLanguage(applicationConfiguration.language);
|
|
440
|
-
initLanguage(applicationConfiguration.language);
|
|
440
|
+
initLanguage(applicationConfiguration.language, applicationConfiguration.network.baseURL);
|
|
441
441
|
}
|
|
442
442
|
|
|
443
443
|
// backward compatibility alias
|