@configuratorware/configurator-frontendgui 1.51.4 → 1.52.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/CreatorScreen.js +1 -1
- package/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +1 -1
- package/App/Modules/Designer/Containers/DesignAreaControlbox.js +0 -1
- package/App/Modules/Designer/Containers/ImageEditDialog.js +2 -2
- package/App/Modules/Designer/DesignerScreen.js +7 -1
- package/App/Modules/Designer/Layouts/DefaultLayout.js +3 -2
- package/App/Modules/Designer/Utils/Transformers.js +1 -1
- package/App/Reducers/Configurator/Selectors.js +1 -10
- package/App/Screens/Configurator/Containers/CalculationWidget.js +0 -1
- package/App/Services/ConfiguratorService.js +0 -31
- package/App/Services/DesignDataService.js +33 -6
- package/App/{Modules/Creator → Shared}/Components/InvalidConfigurationNotice/index.js +3 -3
- package/App/Shared/Containers/AmountPrice/index.js +0 -1
- package/App/{Modules/Creator → Shared}/Containers/InvalidConfigurationNotice/index.js +24 -5
- package/package.json +4 -4
- package/public/translations/de_DE.json +3 -2
- package/public/translations/en_GB.json +3 -2
- package/src/App/Modules/Creator/CreatorScreen.js +1 -1
- package/src/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +1 -1
- package/src/App/Modules/Designer/Containers/DesignAreaControlbox.js +0 -1
- package/src/App/Modules/Designer/Containers/ImageEditDialog.js +2 -1
- package/src/App/Modules/Designer/DesignerScreen.js +5 -0
- package/src/App/Modules/Designer/Layouts/DefaultLayout.js +3 -0
- package/src/App/Modules/Designer/Utils/Transformers.js +1 -0
- package/src/App/Modules/Designer/Utils/__tests__/Transformers.test.js +1 -0
- package/src/App/Reducers/Configurator/Selectors.js +0 -8
- package/src/App/Reducers/Configurator/__tests__/Selectors.test.js +0 -15
- package/src/App/Screens/Configurator/Containers/CalculationWidget.js +1 -2
- package/src/App/Services/ConfiguratorService.js +0 -37
- package/src/App/Services/DesignDataService.js +36 -8
- package/src/App/Services/__tests__/ConfiguratorService.test.js +0 -241
- package/src/App/Services/__tests__/DesignDataService.test.js +10 -5
- package/src/App/{Modules/Creator → Shared}/Components/InvalidConfigurationNotice/index.js +1 -2
- package/src/App/Shared/Containers/AmountPrice/index.js +0 -1
- package/src/App/{Modules/Creator → Shared}/Containers/InvalidConfigurationNotice/index.js +25 -2
- /package/src/App/{Modules/Creator → Shared}/Containers/InvalidConfigurationNotice/index.test.js +0 -0
|
@@ -22,7 +22,7 @@ var _FastConfiguration = _interopRequireDefault(require("./Containers/FastConfig
|
|
|
22
22
|
var _Optiondetail = _interopRequireDefault(require("./Containers/Optiondetail"));
|
|
23
23
|
var _OptionsList = _interopRequireDefault(require("./Containers/OptionsList"));
|
|
24
24
|
var _ProductPartsList = _interopRequireDefault(require("./Containers/ProductPartsList"));
|
|
25
|
-
var _InvalidConfigurationNotice = _interopRequireDefault(require("
|
|
25
|
+
var _InvalidConfigurationNotice = _interopRequireDefault(require("../../Shared/Containers/InvalidConfigurationNotice"));
|
|
26
26
|
var _FullScreenView = _interopRequireDefault(require("./Components/FullScreenView/FullScreenView"));
|
|
27
27
|
var _Option = _interopRequireDefault(require("./Components/Option"));
|
|
28
28
|
var _excluded = ["renderAmountPrice"];
|
|
@@ -95,7 +95,7 @@ var ImageThumbnail = /*#__PURE__*/function (_React$Component) {
|
|
|
95
95
|
case 1:
|
|
96
96
|
svgContent = _context.v;
|
|
97
97
|
this.setState({
|
|
98
|
-
src: (0, _DesignDataService.applySvgContentOperations)(image.preview, image.operations, svgContent)
|
|
98
|
+
src: (0, _DesignDataService.applySvgContentOperations)(image.original, image.preview, image.operations, svgContent)
|
|
99
99
|
});
|
|
100
100
|
case 2:
|
|
101
101
|
return _context.a(2);
|
|
@@ -35,7 +35,6 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
35
35
|
handleChangeProductionMethod: function handleChangeProductionMethod(_ref2) {
|
|
36
36
|
var value = _ref2.target.value;
|
|
37
37
|
_ServiceLocator.Services.designData.setDesignProductionMethod(value);
|
|
38
|
-
_ServiceLocator.Services.configurator.resolveCalculationErrors();
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
};
|
|
@@ -137,7 +137,7 @@ var ImageEditDialogContainer = exports.ImageEditDialogContainer = /*#__PURE__*/f
|
|
|
137
137
|
return (0, _DesignDataService.getSvgContent)(previewUrl, true);
|
|
138
138
|
case 1:
|
|
139
139
|
svgContent = _context.v;
|
|
140
|
-
preview = (0, _DesignDataService.applySvgContentOperations)(image.preview, null, svgContent);
|
|
140
|
+
preview = (0, _DesignDataService.applySvgContentOperations)(image.original, image.preview, null, svgContent);
|
|
141
141
|
_this.setState({
|
|
142
142
|
originalImagePreview: preview
|
|
143
143
|
});
|
|
@@ -425,7 +425,7 @@ var ImageEditDialogContainer = exports.ImageEditDialogContainer = /*#__PURE__*/f
|
|
|
425
425
|
case 1:
|
|
426
426
|
svgContent = _context6.v;
|
|
427
427
|
case 2:
|
|
428
|
-
preview = (0, _DesignDataService.applySvgContentOperations)(image.preview, image.displayColorPreview ? image.operations : null, svgContent);
|
|
428
|
+
preview = (0, _DesignDataService.applySvgContentOperations)(image.original, image.preview, image.displayColorPreview ? image.operations : null, svgContent);
|
|
429
429
|
_context6.n = 4;
|
|
430
430
|
break;
|
|
431
431
|
case 3:
|
|
@@ -8,6 +8,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _ReactComponent = _interopRequireDefault(require("../../../Shared/PropTypes/ReactComponent"));
|
|
10
10
|
var _Header = _interopRequireDefault(require("../../Shared/Containers/Header"));
|
|
11
|
+
var _InvalidConfigurationNotice = _interopRequireDefault(require("../../Shared/Containers/InvalidConfigurationNotice"));
|
|
11
12
|
var _DesignAreaControlbox = _interopRequireDefault(require("./Containers/DesignAreaControlbox"));
|
|
12
13
|
var _EditDesignButton = _interopRequireDefault(require("./Containers/EditDesignButton"));
|
|
13
14
|
var _CloseGraphicsEditorButton = _interopRequireDefault(require("./Containers/CloseGraphicsEditorButton"));
|
|
@@ -57,6 +58,7 @@ function DesignerScreen(props) {
|
|
|
57
58
|
_renderVisualization = props.renderVisualization,
|
|
58
59
|
renderDesignAreaControlbox = props.renderDesignAreaControlbox,
|
|
59
60
|
renderEditDesignButton = props.renderEditDesignButton,
|
|
61
|
+
renderInvalidConfigurationNotice = props.renderInvalidConfigurationNotice,
|
|
60
62
|
renderCloseGraphicsEditorButton = props.renderCloseGraphicsEditorButton,
|
|
61
63
|
renderImageEditDialog = props.renderImageEditDialog,
|
|
62
64
|
renderCloseDesignEditor = props.renderCloseDesignEditor,
|
|
@@ -127,7 +129,8 @@ function DesignerScreen(props) {
|
|
|
127
129
|
}, renderProps.width !== 'xs' ? renderAmountPrice(props) : props.activeDesignArea ? renderCloseGraphicsEditorButton(renderProps) : renderAmountPrice(props))))));
|
|
128
130
|
},
|
|
129
131
|
renderLoader: renderLoader,
|
|
130
|
-
renderLicenseNotice: renderLicenseNotice
|
|
132
|
+
renderLicenseNotice: renderLicenseNotice,
|
|
133
|
+
renderInvalidConfigurationNotice: renderInvalidConfigurationNotice
|
|
131
134
|
}));
|
|
132
135
|
}
|
|
133
136
|
// eslint-disable-next-line react/prop-types
|
|
@@ -190,6 +193,9 @@ DesignerScreen.defaultProps = {
|
|
|
190
193
|
},
|
|
191
194
|
renderEditDesignButton: renderEditDesignButton,
|
|
192
195
|
renderDesignAreaControlbox: renderDesignAreaControlbox,
|
|
196
|
+
renderInvalidConfigurationNotice: function renderInvalidConfigurationNotice() {
|
|
197
|
+
return /*#__PURE__*/React.createElement(_InvalidConfigurationNotice["default"], null);
|
|
198
|
+
},
|
|
193
199
|
// Components
|
|
194
200
|
CanvasProvider: _DefaultCanvasProvider.DefaultCanvasProvider,
|
|
195
201
|
CanvasStateProvider: _DefaultCanvasProvider.DefaultCanvasStateProvider,
|
|
@@ -145,7 +145,8 @@ var DefaultLayout = function DefaultLayout(_ref3) {
|
|
|
145
145
|
imageOnly = _ref3.imageOnly,
|
|
146
146
|
renderDesigner = _ref3.renderDesigner,
|
|
147
147
|
showDesigner = _ref3.showDesigner,
|
|
148
|
-
visualizationOverlayMode = _ref3.visualizationOverlayMode
|
|
148
|
+
visualizationOverlayMode = _ref3.visualizationOverlayMode,
|
|
149
|
+
renderInvalidConfigurationNotice = _ref3.renderInvalidConfigurationNotice;
|
|
149
150
|
return imageOnly ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
150
151
|
className: "".concat(classes.root, " ").concat(fallbackMode ? classes.fallbackMode : '')
|
|
151
152
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -160,7 +161,7 @@ var DefaultLayout = function DefaultLayout(_ref3) {
|
|
|
160
161
|
classes: classes
|
|
161
162
|
}))), renderLoader()) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
162
163
|
className: "".concat(classes.root, " ").concat(fallbackMode ? classes.fallbackMode : '')
|
|
163
|
-
}, renderLicenseNotice(), /*#__PURE__*/_react["default"].createElement("div", {
|
|
164
|
+
}, renderLicenseNotice(), renderInvalidConfigurationNotice(), /*#__PURE__*/_react["default"].createElement("div", {
|
|
164
165
|
className: classes.header
|
|
165
166
|
}, renderHeader({
|
|
166
167
|
area: 'header',
|
|
@@ -83,7 +83,7 @@ var prepareImageObjectData = exports.prepareImageObjectData = function prepareIm
|
|
|
83
83
|
return (0, _DesignDataService.getSvgContent)(url, true);
|
|
84
84
|
case 3:
|
|
85
85
|
svgContent = _context.v;
|
|
86
|
-
return _context.a(2, (0, _DesignDataService.applySvgContentOperations)(image.preview, displayColorPreview || gallery ? operations ? operations : image.operations : null, svgContent));
|
|
86
|
+
return _context.a(2, (0, _DesignDataService.applySvgContentOperations)(image.original, image.preview, displayColorPreview || gallery ? operations ? operations : image.operations : null, svgContent));
|
|
87
87
|
}
|
|
88
88
|
}, _callee);
|
|
89
89
|
}));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.visualizationModeCheck = exports.showReceiveOfferForm = exports.showItemIdentifier = exports.showCallToAction = exports.isSelectedAmountsUpdated = exports.isFallbackVisualizationMode = exports.isDesignerProductPreviewMode = exports.isCalculationAutoResolveEnabled = exports.hasMultipleVariantsSelected = exports.getVisualizationSettings = exports.getUserSelectedCalculation = exports.getShareUrl = exports.getSelectedVariantIdentifier = exports.getSelectedAmounts = exports.getItemSettings = exports.getItem = exports.getDeepestChildIdentifiers = exports.getCurrentVisualizationSettings = exports.getConfigurator = exports.getConfigurationSettings = exports.getConfiguration = exports.getClientTexts = exports.getClientHighlightColor = exports.getClient = exports.getChildren = exports.getCallToAction = exports.getCalculation = exports.getBulkNames = exports.findMaxChildrenCount =
|
|
6
|
+
exports.visualizationModeCheck = exports.showReceiveOfferForm = exports.showItemIdentifier = exports.showCallToAction = exports.isSelectedAmountsUpdated = exports.isFallbackVisualizationMode = exports.isDesignerProductPreviewMode = exports.isCalculationAutoResolveEnabled = exports.hasMultipleVariantsSelected = exports.getVisualizationSettings = exports.getUserSelectedCalculation = exports.getShareUrl = exports.getSelectedVariantIdentifier = exports.getSelectedAmounts = exports.getItemSettings = exports.getItem = exports.getDeepestChildIdentifiers = exports.getCurrentVisualizationSettings = exports.getConfigurator = exports.getConfigurationSettings = exports.getConfiguration = exports.getClientTexts = exports.getClientHighlightColor = exports.getClient = exports.getChildren = exports.getCallToAction = exports.getCalculation = exports.getBulkNames = exports.findMaxChildrenCount = void 0;
|
|
7
7
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
8
8
|
var _flow = _interopRequireDefault(require("lodash/flow"));
|
|
9
9
|
var _find = _interopRequireDefault(require("lodash/find"));
|
|
@@ -129,15 +129,6 @@ var _getDeepestChildIdentifiers = exports.getDeepestChildIdentifiers = function
|
|
|
129
129
|
}
|
|
130
130
|
return result;
|
|
131
131
|
};
|
|
132
|
-
var createCalculationErrorChecker = exports.createCalculationErrorChecker = function createCalculationErrorChecker(configuratorState) {
|
|
133
|
-
var calculation = getCalculation(configuratorState);
|
|
134
|
-
var errorCode = (0, _get["default"])(calculation, 'code');
|
|
135
|
-
return {
|
|
136
|
-
isMinOrderAmountError: function isMinOrderAmountError() {
|
|
137
|
-
return errorCode === 'minimum_order_amount_error';
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
132
|
var getClientHighlightColor = exports.getClientHighlightColor = function getClientHighlightColor(state) {
|
|
142
133
|
return (0, _get["default"])(getClient(getConfigurator(state)), 'theme.highlightColor');
|
|
143
134
|
};
|
|
@@ -172,7 +172,6 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
172
172
|
colorAmountList: colorAmountList,
|
|
173
173
|
designProductionMethods: designProductionMethods,
|
|
174
174
|
amountValue: amountProps.amount,
|
|
175
|
-
amountError: (0, _Selectors3.createCalculationErrorChecker)(state.configurator).isMinOrderAmountError(),
|
|
176
175
|
designAreas: designAreas,
|
|
177
176
|
currentDesignProductionMethod: designProductionMethod,
|
|
178
177
|
colorAmounts: colorAmounts,
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
8
|
-
var _has = _interopRequireDefault(require("lodash/has"));
|
|
9
8
|
var _find = _interopRequireDefault(require("lodash/find"));
|
|
10
9
|
var _map = _interopRequireDefault(require("lodash/map"));
|
|
11
10
|
var _keys2 = _interopRequireDefault(require("lodash/keys"));
|
|
@@ -259,7 +258,6 @@ var ConfiguratorService = exports["default"] = /*#__PURE__*/function (_AbstractC
|
|
|
259
258
|
return _ServiceLocator.Services.store.dispatch(configuratorActions.doCalculation());
|
|
260
259
|
case 1:
|
|
261
260
|
_ServiceLocator.Services.store.dispatch((0, _Actions.setCalculationEnabled)(true));
|
|
262
|
-
_ServiceLocator.Services.configurator.resolveCalculationErrors();
|
|
263
261
|
_context3.n = 3;
|
|
264
262
|
break;
|
|
265
263
|
case 2:
|
|
@@ -798,35 +796,6 @@ var ConfiguratorService = exports["default"] = /*#__PURE__*/function (_AbstractC
|
|
|
798
796
|
var isUpdatedByUser = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
799
797
|
return _ServiceLocator.Services.store.dispatch(configuratorActions.setSelectedAmount(identifier || (0, _Selectors.getSelectedVariantIdentifier)(this.state) || this.state.configuration.item.identifier, amount, isUpdatedByUser));
|
|
800
798
|
}
|
|
801
|
-
}, {
|
|
802
|
-
key: "resolveCalculationErrors",
|
|
803
|
-
value: function resolveCalculationErrors() {
|
|
804
|
-
var configuratorstate = _ServiceLocator.Services.store.state.configurator;
|
|
805
|
-
var configurationItem = (0, _get["default"])(configuratorstate, 'configuration.item', {});
|
|
806
|
-
if ((0, _Selectors.createCalculationErrorChecker)(configuratorstate).isMinOrderAmountError()) {
|
|
807
|
-
var calculation = (0, _Selectors.getCalculation)(configuratorstate);
|
|
808
|
-
calculation.errors.forEach(function (error) {
|
|
809
|
-
var variant = '';
|
|
810
|
-
var amount = 0;
|
|
811
|
-
if (error.itemIdentifier === configurationItem.parentItemIdentifier) {
|
|
812
|
-
var selectedAmounts = (0, _Selectors.getSelectedAmounts)(configuratorstate);
|
|
813
|
-
if ((0, _keys2["default"])(selectedAmounts).length > 1) {
|
|
814
|
-
variant = configuratorstate.selectedVariantIdentifier;
|
|
815
|
-
var selectedVariantAmount = (0, _has["default"])(selectedAmounts, configuratorstate.selectedVariantIdentifier) ? selectedAmounts[configuratorstate.selectedVariantIdentifier] : 0;
|
|
816
|
-
amount = error.minimumAmount - error.selectedAmount + selectedVariantAmount;
|
|
817
|
-
} else {
|
|
818
|
-
variant = configuratorstate.selectedVariantIdentifier;
|
|
819
|
-
amount = error.minimumAmount;
|
|
820
|
-
}
|
|
821
|
-
} else {
|
|
822
|
-
variant = error.itemIdentifier;
|
|
823
|
-
amount = error.minimumAmount;
|
|
824
|
-
}
|
|
825
|
-
_ServiceLocator.Services.store.dispatch(configuratorActions.setSelectedAmount(variant, amount, false));
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
_ServiceLocator.Services.store.dispatch(configuratorActions.setCalculationErrorsResolved());
|
|
829
|
-
}
|
|
830
799
|
}, {
|
|
831
800
|
key: "updateSelectedAmount",
|
|
832
801
|
value: function updateSelectedAmount(oldVariant, newVariant) {
|
|
@@ -327,27 +327,54 @@ var getSvgContent = exports.getSvgContent = function () {
|
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
329
|
}();
|
|
330
|
-
var applySvgContentOperations = exports.applySvgContentOperations = function applySvgContentOperations(preview, operations, svgContent) {
|
|
330
|
+
var applySvgContentOperations = exports.applySvgContentOperations = function applySvgContentOperations(original, preview, operations, svgContent) {
|
|
331
331
|
// add missing attributes to svg tag if needed
|
|
332
332
|
var svgTags = svgContent.match(/<svg[^>]*>/);
|
|
333
333
|
if (svgTags && svgTags[0]) {
|
|
334
334
|
var svgTag = svgTags[0];
|
|
335
335
|
var percentageHeight = /height=["']\d+%["']/;
|
|
336
336
|
var percentageWidth = /width=["']\d+%["']/;
|
|
337
|
+
var scaleFactor = 2048 / preview.width;
|
|
338
|
+
if (preview.height > preview.width) {
|
|
339
|
+
scaleFactor = 2048 / preview.height;
|
|
340
|
+
}
|
|
341
|
+
var pixelWidth = Math.round(preview.width * scaleFactor);
|
|
342
|
+
var pixelHeight = Math.round(preview.height * scaleFactor);
|
|
343
|
+
var isSvgUpload = original.format.toLowerCase() === 'svg';
|
|
337
344
|
if (svgTag.indexOf('viewBox=') === -1) {
|
|
338
|
-
|
|
345
|
+
if (isSvgUpload) {
|
|
346
|
+
svgContent = svgContent.replace('<svg', "<svg viewBox=\"0 0 ".concat(pixelWidth, " ").concat(pixelHeight, "\""));
|
|
347
|
+
} else {
|
|
348
|
+
svgContent = svgContent.replace('<svg', "<svg viewBox=\"0 0 ".concat(preview.width, " ").concat(preview.height, "\""));
|
|
349
|
+
}
|
|
339
350
|
}
|
|
340
351
|
if (svgTag.indexOf('height=') === -1) {
|
|
341
|
-
|
|
352
|
+
if (isSvgUpload) {
|
|
353
|
+
svgContent = svgContent.replace('<svg', "<svg height=\"".concat(pixelHeight, "px\""));
|
|
354
|
+
} else {
|
|
355
|
+
svgContent = svgContent.replace('<svg', "<svg height=\"".concat(preview.height, "px\""));
|
|
356
|
+
}
|
|
342
357
|
}
|
|
343
358
|
if (svgTag.indexOf('width=') === -1) {
|
|
344
|
-
|
|
359
|
+
if (isSvgUpload) {
|
|
360
|
+
svgContent = svgContent.replace('<svg', "<svg width=\"".concat(pixelWidth, "px\""));
|
|
361
|
+
} else {
|
|
362
|
+
svgContent = svgContent.replace('<svg', "<svg width=\"".concat(preview.width, "px\""));
|
|
363
|
+
}
|
|
345
364
|
}
|
|
346
365
|
if (percentageHeight.test(svgTag)) {
|
|
347
|
-
|
|
366
|
+
if (isSvgUpload) {
|
|
367
|
+
svgContent = svgContent.replace(percentageHeight, "height=\"".concat(pixelHeight, "px\""));
|
|
368
|
+
} else {
|
|
369
|
+
svgContent = svgContent.replace(percentageHeight, "height=\"".concat(preview.height, "px\""));
|
|
370
|
+
}
|
|
348
371
|
}
|
|
349
372
|
if (percentageWidth.test(svgTag)) {
|
|
350
|
-
|
|
373
|
+
if (isSvgUpload) {
|
|
374
|
+
svgContent = svgContent.replace(percentageWidth, "width=\"".concat(pixelWidth, "px\""));
|
|
375
|
+
} else {
|
|
376
|
+
svgContent = svgContent.replace(percentageWidth, "width=\"".concat(preview.width, "px\""));
|
|
377
|
+
}
|
|
351
378
|
}
|
|
352
379
|
}
|
|
353
380
|
|
|
@@ -11,13 +11,13 @@ var _styles = require("@material-ui/core/styles");
|
|
|
11
11
|
var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogContent"));
|
|
12
12
|
var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
|
|
13
13
|
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
14
|
-
var _MainButton = _interopRequireDefault(require("
|
|
14
|
+
var _MainButton = _interopRequireDefault(require("../../../../Shared/Components/MainButton"));
|
|
15
15
|
var _List = _interopRequireDefault(require("@material-ui/core/List"));
|
|
16
16
|
var _ListItem = _interopRequireDefault(require("@material-ui/core/ListItem"));
|
|
17
17
|
var _ListItemText = _interopRequireDefault(require("@material-ui/core/ListItemText"));
|
|
18
18
|
var _Divider = _interopRequireDefault(require("@material-ui/core/Divider"));
|
|
19
|
-
var _i18n = require("
|
|
20
|
-
var _CustomDialog = _interopRequireDefault(require("
|
|
19
|
+
var _i18n = require("../../../../Framework/i18n");
|
|
20
|
+
var _CustomDialog = _interopRequireDefault(require("../../../../Shared/Components/CustomDialog"));
|
|
21
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
22
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
23
23
|
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); }
|
|
@@ -211,7 +211,6 @@ var mapDispatchToProps = function mapDispatchToProps() {
|
|
|
211
211
|
return _ServiceLocator.Services.configurator.setSelectedCalculation(identifier, value);
|
|
212
212
|
},
|
|
213
213
|
onClose: function onClose() {
|
|
214
|
-
_ServiceLocator.Services.configurator.resolveCalculationErrors();
|
|
215
214
|
_ServiceLocator.Services.visualization.abortScreenshotting();
|
|
216
215
|
},
|
|
217
216
|
onChangeAmount: function onChangeAmount(amount) {
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var _ComponentContainer = _interopRequireDefault(require("
|
|
7
|
+
var _ComponentContainer = _interopRequireDefault(require("../../../../Framework/ComponentContainer"));
|
|
8
8
|
var _InvalidConfigurationNotice = _interopRequireDefault(require("../../Components/InvalidConfigurationNotice"));
|
|
9
|
-
var _Actions = require("
|
|
10
|
-
var _Selectors = require("
|
|
11
|
-
var _cached = require("
|
|
12
|
-
var _configuration = require("
|
|
9
|
+
var _Actions = require("../../../Reducers/UI/Actions");
|
|
10
|
+
var _Selectors = require("../../../Reducers/Configurator/Selectors");
|
|
11
|
+
var _cached = require("../../../../Utils/Function/cached");
|
|
12
|
+
var _configuration = require("../../../configuration");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
14
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
15
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -28,6 +28,25 @@ var getValidationErrors = function getValidationErrors(configuratorState) {
|
|
|
28
28
|
var _getConfiguration = (0, _Selectors.getConfiguration)(configuratorState),
|
|
29
29
|
optionclassifications = _getConfiguration.optionclassifications;
|
|
30
30
|
return (0, _cached.getCached)('getValidationErrors', validation, optionclassifications && optionclassifications.length).use(function () {
|
|
31
|
+
if (validation.code && validation.code === 'minimum_order_amount_error') {
|
|
32
|
+
var _errors = [];
|
|
33
|
+
var itemTitle = '';
|
|
34
|
+
validation.errors.forEach(function (error, index) {
|
|
35
|
+
itemTitle = error.itemTitle;
|
|
36
|
+
_errors.push({
|
|
37
|
+
message: 'minimumOrderAmountError',
|
|
38
|
+
key: index,
|
|
39
|
+
amounts: {
|
|
40
|
+
minAmount: error.minimumAmount,
|
|
41
|
+
selectedAmount: error.selectedAmount
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
return [{
|
|
46
|
+
title: itemTitle,
|
|
47
|
+
errors: _errors
|
|
48
|
+
}];
|
|
49
|
+
}
|
|
31
50
|
var errors = (validation === null || validation === void 0 ? void 0 : validation.validationErrors) || (validation === null || validation === void 0 ? void 0 : validation.errors) || {};
|
|
32
51
|
return !optionclassifications ? [] : Object.entries(errors).map(function (_ref) {
|
|
33
52
|
var _optionclassification;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-frontendgui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.52.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.52.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.52.0",
|
|
40
|
+
"redhotmagma-visualization": "1.52.0",
|
|
41
41
|
"redux": "^4.1.0",
|
|
42
42
|
"redux-logger": "^3.0.6",
|
|
43
43
|
"redux-persist": "^5.10.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"amount": "Menge",
|
|
40
40
|
"minimumAmountError": "Die Mindestbestellmenge von %{minimumAmount} für %{itemTitle} ist nicht erreicht. Gewählte Menge: %{selectedAmount}.",
|
|
41
41
|
"showPriceList": "Preisliste anzeigen",
|
|
42
|
-
"bulkSavings": "%{itemTitle}: Bestelle noch %{savingsBulkAmount} mehr und spare %{savingAmount}
|
|
42
|
+
"bulkSavings": "%{itemTitle}: Bestelle noch %{savingsBulkAmount} mehr und spare %{savingAmount} % auf den Basispreis des Produktes."
|
|
43
43
|
},
|
|
44
44
|
"amountSelection": {
|
|
45
45
|
"total": "Gesamt: ",
|
|
@@ -391,7 +391,8 @@
|
|
|
391
391
|
"errorTypes": {
|
|
392
392
|
"no_selected_option_in_mandatory_component": "In dieser Komponente muss eine Option gewählt sein. ",
|
|
393
393
|
"selected_option_no_longer_available": "Gewählte Option(en) in dieser Komponente sind nicht mehr verfügbar. ",
|
|
394
|
-
"minamount_not_met": "Die Mindestmenge an Optionen für diese Komponente ist %{minimumAmount} (%{selectedAmount} gewählt). "
|
|
394
|
+
"minamount_not_met": "Die Mindestmenge an Optionen für diese Komponente ist %{minimumAmount} (%{selectedAmount} gewählt). ",
|
|
395
|
+
"minimumOrderAmountError": "Die Mindestbestellmenge für den Artikel beträgt %{minimumAmount} (%{selectedAmount} gewählt). "
|
|
395
396
|
}
|
|
396
397
|
},
|
|
397
398
|
"common": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"MainCallToActionLabel": "request a quote",
|
|
40
40
|
"minimumAmountError": "The minimum order amount of %{minimumAmount} for %{itemTitle} is not reached. Selected amount: %{selectedAmount}.",
|
|
41
41
|
"showPriceList": "Show price list",
|
|
42
|
-
"bulkSavings": "%{itemTitle}: Order %{savingsBulkAmount} more to save %{savingAmount}
|
|
42
|
+
"bulkSavings": "%{itemTitle}: Order %{savingsBulkAmount} more to save %{savingAmount} % on the articles base price."
|
|
43
43
|
},
|
|
44
44
|
"amountSelection": {
|
|
45
45
|
"total": "Total: %{value} amount",
|
|
@@ -391,7 +391,8 @@
|
|
|
391
391
|
"errorTypes": {
|
|
392
392
|
"no_selected_option_in_mandatory_component": "In this component an option has to be selected. ",
|
|
393
393
|
"selected_option_no_longer_available": "Selected option(s) in this component are not available anymore. ",
|
|
394
|
-
"minamount_not_met": "The minimum amount for options in this component is %{minimumAmount} (%{selectedAmount} selected). "
|
|
394
|
+
"minamount_not_met": "The minimum amount for options in this component is %{minimumAmount} (%{selectedAmount} selected). ",
|
|
395
|
+
"minimumOrderAmountError": "The minimum order amount for the article is %{minimumAmount} (%{selectedAmount} selected). "
|
|
395
396
|
}
|
|
396
397
|
},
|
|
397
398
|
"common": {
|
|
@@ -18,7 +18,7 @@ import FastConfigurationContainer from './Containers/FastConfiguration';
|
|
|
18
18
|
import OptionDetailContainer from './Containers/Optiondetail';
|
|
19
19
|
import OptionsListContainer from './Containers/OptionsList';
|
|
20
20
|
import ProductPartsListContainer from './Containers/ProductPartsList';
|
|
21
|
-
import InvalidConfigurationNotice from '
|
|
21
|
+
import InvalidConfigurationNotice from 'App/Shared/Containers/InvalidConfigurationNotice';
|
|
22
22
|
import FullScreenView from './Components/FullScreenView/FullScreenView';
|
|
23
23
|
|
|
24
24
|
import Option from './Components/Option';
|
|
@@ -64,7 +64,7 @@ class ImageThumbnail extends React.Component {
|
|
|
64
64
|
const svgContent = await getSvgContent(getPreviewUrlFromImageData(image.preview), true);
|
|
65
65
|
|
|
66
66
|
this.setState({
|
|
67
|
-
src: applySvgContentOperations(image.preview, image.operations, svgContent),
|
|
67
|
+
src: applySvgContentOperations(image.original, image.preview, image.operations, svgContent),
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -31,7 +31,6 @@ const mapStateToProps = state => {
|
|
|
31
31
|
handleChangeDesignArea: ({ target: { value } }) => Services.designData.selectDesignArea(value),
|
|
32
32
|
handleChangeProductionMethod: ({ target: { value } }) => {
|
|
33
33
|
Services.designData.setDesignProductionMethod(value);
|
|
34
|
-
Services.configurator.resolveCalculationErrors();
|
|
35
34
|
},
|
|
36
35
|
};
|
|
37
36
|
};
|
|
@@ -323,7 +323,7 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
323
323
|
const isSvg = previewUrl && /\.svg$/.test(previewUrl);
|
|
324
324
|
if (isSvg) {
|
|
325
325
|
const svgContent = await getSvgContent(previewUrl, true);
|
|
326
|
-
const preview = applySvgContentOperations(image.preview, null, svgContent);
|
|
326
|
+
const preview = applySvgContentOperations(image.original, image.preview, null, svgContent);
|
|
327
327
|
|
|
328
328
|
this.setState({
|
|
329
329
|
originalImagePreview: preview,
|
|
@@ -537,6 +537,7 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
537
537
|
}
|
|
538
538
|
|
|
539
539
|
preview = applySvgContentOperations(
|
|
540
|
+
image.original,
|
|
540
541
|
image.preview,
|
|
541
542
|
image.displayColorPreview ? image.operations : null,
|
|
542
543
|
svgContent
|
|
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import ReactComponentType from 'Shared/PropTypes/ReactComponent';
|
|
5
5
|
|
|
6
6
|
import Header from 'App/Shared/Containers/Header';
|
|
7
|
+
import InvalidConfigurationNotice from 'App/Shared/Containers/InvalidConfigurationNotice';
|
|
7
8
|
import DesignAreaControlbox from './Containers/DesignAreaControlbox';
|
|
8
9
|
import EditDesignButton from './Containers/EditDesignButton';
|
|
9
10
|
import CloseGraphicsEditorButton from './Containers/CloseGraphicsEditorButton';
|
|
@@ -53,6 +54,7 @@ export function DesignerScreen(props) {
|
|
|
53
54
|
renderVisualization,
|
|
54
55
|
renderDesignAreaControlbox,
|
|
55
56
|
renderEditDesignButton,
|
|
57
|
+
renderInvalidConfigurationNotice,
|
|
56
58
|
renderCloseGraphicsEditorButton,
|
|
57
59
|
renderImageEditDialog,
|
|
58
60
|
renderCloseDesignEditor,
|
|
@@ -198,6 +200,7 @@ export function DesignerScreen(props) {
|
|
|
198
200
|
)}
|
|
199
201
|
renderLoader={renderLoader}
|
|
200
202
|
renderLicenseNotice={renderLicenseNotice}
|
|
203
|
+
renderInvalidConfigurationNotice={renderInvalidConfigurationNotice}
|
|
201
204
|
/>
|
|
202
205
|
</CanvasProvider>
|
|
203
206
|
);
|
|
@@ -225,6 +228,7 @@ DesignerScreen.propTypes = {
|
|
|
225
228
|
renderImageEditDialog: PropTypes.func,
|
|
226
229
|
renderCloseDesignEditor: PropTypes.func,
|
|
227
230
|
renderAddVisualElement: PropTypes.func,
|
|
231
|
+
renderInvalidConfigurationNotice: PropTypes.func,
|
|
228
232
|
|
|
229
233
|
// Components
|
|
230
234
|
CanvasProvider: ReactComponentType.isRequired,
|
|
@@ -272,6 +276,7 @@ DesignerScreen.defaultProps = {
|
|
|
272
276
|
renderAddVisualElement: () => <AddVisualElement autoHide />,
|
|
273
277
|
renderEditDesignButton,
|
|
274
278
|
renderDesignAreaControlbox,
|
|
279
|
+
renderInvalidConfigurationNotice: () => <InvalidConfigurationNotice />,
|
|
275
280
|
|
|
276
281
|
// Components
|
|
277
282
|
CanvasProvider: DefaultCanvasProvider,
|
|
@@ -153,6 +153,7 @@ const DefaultLayout = ({
|
|
|
153
153
|
renderDesigner,
|
|
154
154
|
showDesigner,
|
|
155
155
|
visualizationOverlayMode,
|
|
156
|
+
renderInvalidConfigurationNotice,
|
|
156
157
|
}) => {
|
|
157
158
|
return imageOnly ? (
|
|
158
159
|
<div className={`${classes.root} ${fallbackMode ? classes.fallbackMode : ''}`}>
|
|
@@ -171,6 +172,7 @@ const DefaultLayout = ({
|
|
|
171
172
|
) : (
|
|
172
173
|
<div className={`${classes.root} ${fallbackMode ? classes.fallbackMode : ''}`}>
|
|
173
174
|
{renderLicenseNotice()}
|
|
175
|
+
{renderInvalidConfigurationNotice()}
|
|
174
176
|
<div className={classes.header}>
|
|
175
177
|
{renderHeader({
|
|
176
178
|
area: 'header',
|
|
@@ -222,6 +224,7 @@ DefaultLayout.propTypes = {
|
|
|
222
224
|
fallbackMode: PropTypes.bool,
|
|
223
225
|
isPortraitMode: PropTypes.bool,
|
|
224
226
|
imageOnly: PropTypes.bool,
|
|
227
|
+
renderInvalidConfigurationNotice: PropTypes.func,
|
|
225
228
|
};
|
|
226
229
|
|
|
227
230
|
export default withStyles(styles, { name: 'DefaultLayout' })(
|
|
@@ -47,6 +47,7 @@ export const prepareImageObjectData = rawObject => {
|
|
|
47
47
|
const svgContent = await getSvgContent(url, true);
|
|
48
48
|
|
|
49
49
|
return applySvgContentOperations(
|
|
50
|
+
image.original,
|
|
50
51
|
image.preview,
|
|
51
52
|
displayColorPreview || gallery ? (operations ? operations : image.operations) : null,
|
|
52
53
|
svgContent
|
|
@@ -144,6 +144,7 @@ describe('App/Modules/Designer/Utils/Transformers', () => {
|
|
|
144
144
|
const preparedImageData = prepareImageObjectData(imageObjectData);
|
|
145
145
|
await preparedImageData.transformImageSrc(currentSrc);
|
|
146
146
|
expect(DesignDataHelpers.applySvgContentOperations).toBeCalledWith(
|
|
147
|
+
imageData.original,
|
|
147
148
|
imageData.preview,
|
|
148
149
|
imageData.operations,
|
|
149
150
|
'<svg></svg>'
|
|
@@ -106,14 +106,6 @@ export const getDeepestChildIdentifiers = item => {
|
|
|
106
106
|
return result;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
export const createCalculationErrorChecker = configuratorState => {
|
|
110
|
-
const calculation = getCalculation(configuratorState);
|
|
111
|
-
const errorCode = get(calculation, 'code');
|
|
112
|
-
return {
|
|
113
|
-
isMinOrderAmountError: () => errorCode === 'minimum_order_amount_error',
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
|
|
117
109
|
export const getClientHighlightColor = state =>
|
|
118
110
|
get(getClient(getConfigurator(state)), 'theme.highlightColor');
|
|
119
111
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
createCalculationErrorChecker,
|
|
3
2
|
findMaxChildrenCount,
|
|
4
3
|
getCalculation,
|
|
5
4
|
getClientHighlightColor,
|
|
@@ -313,20 +312,6 @@ describe('Reducers/Configurator/Selectors', () => {
|
|
|
313
312
|
xl: 'demo_hoodie_blue_xl',
|
|
314
313
|
});
|
|
315
314
|
});
|
|
316
|
-
test('createCalculationErrorChecker.isMinOrderAmountError returns false if there is no error', () => {
|
|
317
|
-
const configuratorState = {
|
|
318
|
-
calculation: {},
|
|
319
|
-
};
|
|
320
|
-
expect(createCalculationErrorChecker(configuratorState).isMinOrderAmountError()).toBe(false);
|
|
321
|
-
});
|
|
322
|
-
test('createCalculationErrorChecker.isMinOrderAmountError returns true if the minimum_order_amount_error is present', () => {
|
|
323
|
-
const configuratorState = {
|
|
324
|
-
calculation: {
|
|
325
|
-
code: 'minimum_order_amount_error',
|
|
326
|
-
},
|
|
327
|
-
};
|
|
328
|
-
expect(createCalculationErrorChecker(configuratorState).isMinOrderAmountError()).toBe(true);
|
|
329
|
-
});
|
|
330
315
|
test('getItemSettings returns the settings of the configuration item', () => {
|
|
331
316
|
const settings = {
|
|
332
317
|
visualizationCreator: '3d',
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
getDefaultDesignAreaIdentifierFromProductionMethod,
|
|
17
17
|
} from 'App/Reducers/DesignArea/Selectors';
|
|
18
18
|
import { createBackgroundWorkStateSelector } from 'App/Reducers/UI/Selectors';
|
|
19
|
-
import {
|
|
19
|
+
import { getItem } from 'App/Reducers/Configurator/Selectors';
|
|
20
20
|
|
|
21
21
|
import CalculationWidget from '../Components/CalculationWidget';
|
|
22
22
|
import Notification from 'App/Shared/Components/Notification';
|
|
@@ -185,7 +185,6 @@ const mapStateToProps = state => {
|
|
|
185
185
|
colorAmountList: colorAmountList,
|
|
186
186
|
designProductionMethods: designProductionMethods,
|
|
187
187
|
amountValue: amountProps.amount,
|
|
188
|
-
amountError: createCalculationErrorChecker(state.configurator).isMinOrderAmountError(),
|
|
189
188
|
designAreas: designAreas,
|
|
190
189
|
currentDesignProductionMethod: designProductionMethod,
|
|
191
190
|
colorAmounts: colorAmounts,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import has from 'lodash/has';
|
|
3
2
|
import find from 'lodash/find';
|
|
4
3
|
import map from 'lodash/map';
|
|
5
4
|
import keys from 'lodash/keys';
|
|
@@ -16,8 +15,6 @@ import {
|
|
|
16
15
|
isSelectedAmountsUpdated,
|
|
17
16
|
hasMultipleVariantsSelected,
|
|
18
17
|
getDeepestChildIdentifiers,
|
|
19
|
-
createCalculationErrorChecker,
|
|
20
|
-
getCalculation,
|
|
21
18
|
isCalculationAutoResolveEnabled,
|
|
22
19
|
getConfiguration,
|
|
23
20
|
getChildren,
|
|
@@ -181,7 +178,6 @@ export default class ConfiguratorService extends AbstractConfiguratorService {
|
|
|
181
178
|
// triggering the calculation directly to make sure it's synced
|
|
182
179
|
await Services.store.dispatch(configuratorActions.doCalculation());
|
|
183
180
|
Services.store.dispatch(setCalculationEnabled(true));
|
|
184
|
-
Services.configurator.resolveCalculationErrors();
|
|
185
181
|
} else {
|
|
186
182
|
Services.store.dispatch(configuratorActions.invalidateCalculation());
|
|
187
183
|
Services.store.dispatch(configuratorActions.doCalculation());
|
|
@@ -583,39 +579,6 @@ export default class ConfiguratorService extends AbstractConfiguratorService {
|
|
|
583
579
|
);
|
|
584
580
|
}
|
|
585
581
|
|
|
586
|
-
resolveCalculationErrors() {
|
|
587
|
-
const configuratorstate = Services.store.state.configurator;
|
|
588
|
-
const configurationItem = get(configuratorstate, 'configuration.item', {});
|
|
589
|
-
if (createCalculationErrorChecker(configuratorstate).isMinOrderAmountError()) {
|
|
590
|
-
const calculation = getCalculation(configuratorstate);
|
|
591
|
-
calculation.errors.forEach(error => {
|
|
592
|
-
let variant = '';
|
|
593
|
-
let amount = 0;
|
|
594
|
-
if (error.itemIdentifier === configurationItem.parentItemIdentifier) {
|
|
595
|
-
const selectedAmounts = getSelectedAmounts(configuratorstate);
|
|
596
|
-
if (keys(selectedAmounts).length > 1) {
|
|
597
|
-
variant = configuratorstate.selectedVariantIdentifier;
|
|
598
|
-
const selectedVariantAmount = has(
|
|
599
|
-
selectedAmounts,
|
|
600
|
-
configuratorstate.selectedVariantIdentifier
|
|
601
|
-
)
|
|
602
|
-
? selectedAmounts[configuratorstate.selectedVariantIdentifier]
|
|
603
|
-
: 0;
|
|
604
|
-
amount = error.minimumAmount - error.selectedAmount + selectedVariantAmount;
|
|
605
|
-
} else {
|
|
606
|
-
variant = configuratorstate.selectedVariantIdentifier;
|
|
607
|
-
amount = error.minimumAmount;
|
|
608
|
-
}
|
|
609
|
-
} else {
|
|
610
|
-
variant = error.itemIdentifier;
|
|
611
|
-
amount = error.minimumAmount;
|
|
612
|
-
}
|
|
613
|
-
Services.store.dispatch(configuratorActions.setSelectedAmount(variant, amount, false));
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
Services.store.dispatch(configuratorActions.setCalculationErrorsResolved());
|
|
617
|
-
}
|
|
618
|
-
|
|
619
582
|
updateSelectedAmount(oldVariant, newVariant) {
|
|
620
583
|
if (!isSelectedAmountsUpdated(this.state) && !hasMultipleVariantsSelected(this.state)) {
|
|
621
584
|
if (
|
|
@@ -399,7 +399,7 @@ export const getSvgContent = (() => {
|
|
|
399
399
|
};
|
|
400
400
|
})();
|
|
401
401
|
|
|
402
|
-
export const applySvgContentOperations = (preview, operations, svgContent) => {
|
|
402
|
+
export const applySvgContentOperations = (original, preview, operations, svgContent) => {
|
|
403
403
|
// add missing attributes to svg tag if needed
|
|
404
404
|
const svgTags = svgContent.match(/<svg[^>]*>/s);
|
|
405
405
|
|
|
@@ -407,25 +407,54 @@ export const applySvgContentOperations = (preview, operations, svgContent) => {
|
|
|
407
407
|
const svgTag = svgTags[0];
|
|
408
408
|
const percentageHeight = /height=["']\d+%["']/;
|
|
409
409
|
const percentageWidth = /width=["']\d+%["']/;
|
|
410
|
-
|
|
410
|
+
let scaleFactor = 2048 / preview.width;
|
|
411
|
+
if (preview.height > preview.width) {
|
|
412
|
+
scaleFactor = 2048 / preview.height;
|
|
413
|
+
}
|
|
414
|
+
const pixelWidth = Math.round(preview.width * scaleFactor);
|
|
415
|
+
const pixelHeight = Math.round(preview.height * scaleFactor);
|
|
416
|
+
const isSvgUpload = original.format.toLowerCase() === 'svg';
|
|
411
417
|
if (svgTag.indexOf('viewBox=') === -1) {
|
|
412
|
-
|
|
418
|
+
if (isSvgUpload) {
|
|
419
|
+
svgContent = svgContent.replace('<svg', `<svg viewBox="0 0 ${pixelWidth} ${pixelHeight}"`);
|
|
420
|
+
} else {
|
|
421
|
+
svgContent = svgContent.replace(
|
|
422
|
+
'<svg',
|
|
423
|
+
`<svg viewBox="0 0 ${preview.width} ${preview.height}"`
|
|
424
|
+
);
|
|
425
|
+
}
|
|
413
426
|
}
|
|
414
427
|
|
|
415
428
|
if (svgTag.indexOf('height=') === -1) {
|
|
416
|
-
|
|
429
|
+
if (isSvgUpload) {
|
|
430
|
+
svgContent = svgContent.replace('<svg', `<svg height="${pixelHeight}px"`);
|
|
431
|
+
} else {
|
|
432
|
+
svgContent = svgContent.replace('<svg', `<svg height="${preview.height}px"`);
|
|
433
|
+
}
|
|
417
434
|
}
|
|
418
435
|
|
|
419
436
|
if (svgTag.indexOf('width=') === -1) {
|
|
420
|
-
|
|
437
|
+
if (isSvgUpload) {
|
|
438
|
+
svgContent = svgContent.replace('<svg', `<svg width="${pixelWidth}px"`);
|
|
439
|
+
} else {
|
|
440
|
+
svgContent = svgContent.replace('<svg', `<svg width="${preview.width}px"`);
|
|
441
|
+
}
|
|
421
442
|
}
|
|
422
443
|
|
|
423
444
|
if (percentageHeight.test(svgTag)) {
|
|
424
|
-
|
|
445
|
+
if (isSvgUpload) {
|
|
446
|
+
svgContent = svgContent.replace(percentageHeight, `height="${pixelHeight}px"`);
|
|
447
|
+
} else {
|
|
448
|
+
svgContent = svgContent.replace(percentageHeight, `height="${preview.height}px"`);
|
|
449
|
+
}
|
|
425
450
|
}
|
|
426
451
|
|
|
427
452
|
if (percentageWidth.test(svgTag)) {
|
|
428
|
-
|
|
453
|
+
if (isSvgUpload) {
|
|
454
|
+
svgContent = svgContent.replace(percentageWidth, `width="${pixelWidth}px"`);
|
|
455
|
+
} else {
|
|
456
|
+
svgContent = svgContent.replace(percentageWidth, `width="${preview.width}px"`);
|
|
457
|
+
}
|
|
429
458
|
}
|
|
430
459
|
}
|
|
431
460
|
|
|
@@ -439,7 +468,6 @@ export const applySvgContentOperations = (preview, operations, svgContent) => {
|
|
|
439
468
|
Object.keys(operations.vectorizeColorsMap).length
|
|
440
469
|
) {
|
|
441
470
|
const colorRegex = new RegExp(`(${Object.keys(operations.vectorizeColorsMap).join('|')})`, 'ig');
|
|
442
|
-
|
|
443
471
|
svgContent = svgContent.replace(colorRegex, match => {
|
|
444
472
|
const { value } = operations.vectorizeColorsMap[match.toLowerCase()];
|
|
445
473
|
|
|
@@ -197,247 +197,6 @@ describe('Services/ConfiguratorService', () => {
|
|
|
197
197
|
});
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
-
test('resolveCalculationErrors for minAmount error', () => {
|
|
201
|
-
class StoreService {
|
|
202
|
-
static serviceName = 'StoreService';
|
|
203
|
-
|
|
204
|
-
observeStore() {}
|
|
205
|
-
|
|
206
|
-
get state() {
|
|
207
|
-
return {
|
|
208
|
-
configurator: {
|
|
209
|
-
calculation: {
|
|
210
|
-
code: 'minimum_order_amount_error',
|
|
211
|
-
errors: [
|
|
212
|
-
{
|
|
213
|
-
itemIdentifier: 'default_first_variant',
|
|
214
|
-
itemTitle: 'Demo Kugelschreiber Durchsichtig',
|
|
215
|
-
minimumAmount: 300,
|
|
216
|
-
selectedAmount: 50,
|
|
217
|
-
},
|
|
218
|
-
],
|
|
219
|
-
},
|
|
220
|
-
selectedVariantIdentifier: 'default_first_variant',
|
|
221
|
-
configuration: {
|
|
222
|
-
customdata: {
|
|
223
|
-
selectedAmounts: {},
|
|
224
|
-
},
|
|
225
|
-
item: {
|
|
226
|
-
parentItemIdentifier: 'test_identifier',
|
|
227
|
-
itemGroup: {
|
|
228
|
-
children: [
|
|
229
|
-
{
|
|
230
|
-
identifier: 'default_first_variant',
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
identifier: 'default_second_variant',
|
|
234
|
-
},
|
|
235
|
-
],
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
dispatch = jest.fn();
|
|
244
|
-
}
|
|
245
|
-
const storeSrvc = new StoreService();
|
|
246
|
-
const configuratorSrv = new ConfiguratorService();
|
|
247
|
-
|
|
248
|
-
ServiceLocator.provide(storeSrvc);
|
|
249
|
-
configuratorSrv.resolveCalculationErrors();
|
|
250
|
-
|
|
251
|
-
expect(storeSrvc.dispatch).toBeCalledWith({
|
|
252
|
-
type: SET_SELECTED_AMOUNT,
|
|
253
|
-
identifier: 'default_first_variant',
|
|
254
|
-
isUpdatedByUser: false,
|
|
255
|
-
amount: 300,
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
test('resolveCalculationErrors on design_production method change and customdata.selectedAmounts is empty', () => {
|
|
260
|
-
class StoreService {
|
|
261
|
-
static serviceName = 'StoreService';
|
|
262
|
-
|
|
263
|
-
observeStore() {}
|
|
264
|
-
|
|
265
|
-
get state() {
|
|
266
|
-
return {
|
|
267
|
-
configurator: {
|
|
268
|
-
calculation: {
|
|
269
|
-
code: 'minimum_order_amount_error',
|
|
270
|
-
errors: [
|
|
271
|
-
{
|
|
272
|
-
itemIdentifier: 'test_identifier',
|
|
273
|
-
itemTitle: 'Demo Kugelschreiber Durchsichtig',
|
|
274
|
-
minimumAmount: 200,
|
|
275
|
-
selectedAmount: 50,
|
|
276
|
-
},
|
|
277
|
-
],
|
|
278
|
-
},
|
|
279
|
-
selectedVariantIdentifier: 'default_first_variant',
|
|
280
|
-
configuration: {
|
|
281
|
-
customdata: {
|
|
282
|
-
selectedAmounts: {},
|
|
283
|
-
},
|
|
284
|
-
item: {
|
|
285
|
-
parentItemIdentifier: 'test_identifier',
|
|
286
|
-
itemGroup: {
|
|
287
|
-
children: [
|
|
288
|
-
{
|
|
289
|
-
identifier: 'default_first_variant',
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
identifier: 'default_second_variant',
|
|
293
|
-
},
|
|
294
|
-
],
|
|
295
|
-
},
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
dispatch = jest.fn();
|
|
303
|
-
}
|
|
304
|
-
const storeSrvc = new StoreService();
|
|
305
|
-
const configuratorSrv = new ConfiguratorService();
|
|
306
|
-
|
|
307
|
-
ServiceLocator.provide(storeSrvc);
|
|
308
|
-
configuratorSrv.resolveCalculationErrors();
|
|
309
|
-
|
|
310
|
-
expect(storeSrvc.dispatch).toBeCalledWith({
|
|
311
|
-
type: SET_SELECTED_AMOUNT,
|
|
312
|
-
identifier: 'default_first_variant',
|
|
313
|
-
isUpdatedByUser: false,
|
|
314
|
-
amount: 200,
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
test('resolveCalculationErrors on design_production method change and customdata.selectedAmounts with 1 selection', () => {
|
|
319
|
-
class StoreService {
|
|
320
|
-
static serviceName = 'StoreService';
|
|
321
|
-
|
|
322
|
-
observeStore() {}
|
|
323
|
-
|
|
324
|
-
get state() {
|
|
325
|
-
return {
|
|
326
|
-
configurator: {
|
|
327
|
-
calculation: {
|
|
328
|
-
code: 'minimum_order_amount_error',
|
|
329
|
-
errors: [
|
|
330
|
-
{
|
|
331
|
-
itemIdentifier: 'test_identifier',
|
|
332
|
-
itemTitle: 'Demo Kugelschreiber Durchsichtig',
|
|
333
|
-
minimumAmount: 200,
|
|
334
|
-
selectedAmount: 20,
|
|
335
|
-
},
|
|
336
|
-
],
|
|
337
|
-
},
|
|
338
|
-
selectedVariantIdentifier: 'default_first_variant',
|
|
339
|
-
configuration: {
|
|
340
|
-
customdata: {
|
|
341
|
-
selectedAmounts: {
|
|
342
|
-
default_second_variant: 20,
|
|
343
|
-
},
|
|
344
|
-
},
|
|
345
|
-
item: {
|
|
346
|
-
parentItemIdentifier: 'test_identifier',
|
|
347
|
-
itemGroup: {
|
|
348
|
-
children: [
|
|
349
|
-
{
|
|
350
|
-
identifier: 'default_first_variant',
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
identifier: 'default_second_variant',
|
|
354
|
-
},
|
|
355
|
-
],
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
},
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
dispatch = jest.fn();
|
|
364
|
-
}
|
|
365
|
-
const storeSrvc = new StoreService();
|
|
366
|
-
const configuratorSrv = new ConfiguratorService();
|
|
367
|
-
|
|
368
|
-
ServiceLocator.provide(storeSrvc);
|
|
369
|
-
configuratorSrv.resolveCalculationErrors();
|
|
370
|
-
|
|
371
|
-
expect(storeSrvc.dispatch).toBeCalledWith({
|
|
372
|
-
type: SET_SELECTED_AMOUNT,
|
|
373
|
-
identifier: 'default_first_variant',
|
|
374
|
-
isUpdatedByUser: false,
|
|
375
|
-
amount: 200,
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
test('resolveCalculationErrors on design_production method change and customdata.selectedAmounts with 2 selections', () => {
|
|
380
|
-
class StoreService {
|
|
381
|
-
static serviceName = 'StoreService';
|
|
382
|
-
|
|
383
|
-
observeStore() {}
|
|
384
|
-
|
|
385
|
-
get state() {
|
|
386
|
-
return {
|
|
387
|
-
configurator: {
|
|
388
|
-
calculation: {
|
|
389
|
-
code: 'minimum_order_amount_error',
|
|
390
|
-
errors: [
|
|
391
|
-
{
|
|
392
|
-
itemIdentifier: 'test_identifier',
|
|
393
|
-
itemTitle: 'Demo Kugelschreiber Durchsichtig',
|
|
394
|
-
minimumAmount: 200,
|
|
395
|
-
selectedAmount: 40,
|
|
396
|
-
},
|
|
397
|
-
],
|
|
398
|
-
},
|
|
399
|
-
selectedVariantIdentifier: 'default_second_variant',
|
|
400
|
-
configuration: {
|
|
401
|
-
customdata: {
|
|
402
|
-
selectedAmounts: {
|
|
403
|
-
default_second_variant: 20,
|
|
404
|
-
default_first_variant: 20,
|
|
405
|
-
},
|
|
406
|
-
},
|
|
407
|
-
item: {
|
|
408
|
-
parentItemIdentifier: 'test_identifier',
|
|
409
|
-
itemGroup: {
|
|
410
|
-
children: [
|
|
411
|
-
{
|
|
412
|
-
identifier: 'default_first_variant',
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
identifier: 'default_second_variant',
|
|
416
|
-
},
|
|
417
|
-
],
|
|
418
|
-
},
|
|
419
|
-
},
|
|
420
|
-
},
|
|
421
|
-
},
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
dispatch = jest.fn();
|
|
426
|
-
}
|
|
427
|
-
const storeSrvc = new StoreService();
|
|
428
|
-
const configuratorSrv = new ConfiguratorService();
|
|
429
|
-
|
|
430
|
-
ServiceLocator.provide(storeSrvc);
|
|
431
|
-
configuratorSrv.resolveCalculationErrors();
|
|
432
|
-
|
|
433
|
-
expect(storeSrvc.dispatch).toBeCalledWith({
|
|
434
|
-
type: SET_SELECTED_AMOUNT,
|
|
435
|
-
identifier: 'default_second_variant',
|
|
436
|
-
isUpdatedByUser: false,
|
|
437
|
-
amount: 180,
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
|
|
441
200
|
test('clearBulkNames dispatches the correct action', () => {
|
|
442
201
|
const configuratorSrvc = new ConfiguratorService();
|
|
443
202
|
const storeSrvc = new StoreService();
|
|
@@ -877,6 +877,9 @@ describe('Services/DesignDataService', () => {
|
|
|
877
877
|
});
|
|
878
878
|
|
|
879
879
|
test('applySvgContentOperations returns the correct src', () => {
|
|
880
|
+
const original = {
|
|
881
|
+
format: 'SVG',
|
|
882
|
+
};
|
|
880
883
|
const preview = {
|
|
881
884
|
width: 200,
|
|
882
885
|
height: 100,
|
|
@@ -888,9 +891,9 @@ describe('Services/DesignDataService', () => {
|
|
|
888
891
|
},
|
|
889
892
|
};
|
|
890
893
|
|
|
891
|
-
const getResult = (preview, operations, svgContent) =>
|
|
894
|
+
const getResult = (original, preview, operations, svgContent) =>
|
|
892
895
|
atob(
|
|
893
|
-
applySvgContentOperations(preview, operations, svgContent).replace(
|
|
896
|
+
applySvgContentOperations(original, preview, operations, svgContent).replace(
|
|
894
897
|
/^data:image\/svg\+xml;base64,/,
|
|
895
898
|
''
|
|
896
899
|
)
|
|
@@ -898,12 +901,14 @@ describe('Services/DesignDataService', () => {
|
|
|
898
901
|
|
|
899
902
|
const svgContentWithoutWidthHeight = '<svg><circle r="10" fill="#ff0000" /></svg>';
|
|
900
903
|
const svgContentWithWidthHeight =
|
|
901
|
-
'<svg width="
|
|
904
|
+
'<svg width="2048px" height="1024px" viewBox="0 0 2048 1024"><circle r="10" fill="#0000ff" /></svg>';
|
|
902
905
|
|
|
903
|
-
expect(getResult(preview, operations, svgContentWithoutWidthHeight)).toEqual(
|
|
906
|
+
expect(getResult(original, preview, operations, svgContentWithoutWidthHeight)).toEqual(
|
|
907
|
+
svgContentWithWidthHeight
|
|
908
|
+
);
|
|
909
|
+
expect(getResult(original, preview, operations, svgContentWithWidthHeight)).toEqual(
|
|
904
910
|
svgContentWithWidthHeight
|
|
905
911
|
);
|
|
906
|
-
expect(getResult(preview, operations, svgContentWithWidthHeight)).toEqual(svgContentWithWidthHeight);
|
|
907
912
|
});
|
|
908
913
|
|
|
909
914
|
describe('getSvgColors', () => {
|
|
@@ -12,7 +12,7 @@ import ListItem from '@material-ui/core/ListItem';
|
|
|
12
12
|
import ListItemText from '@material-ui/core/ListItemText';
|
|
13
13
|
import Divider from '@material-ui/core/Divider';
|
|
14
14
|
import { T } from 'Framework/i18n';
|
|
15
|
-
import CustomDialog from '
|
|
15
|
+
import CustomDialog from '../../../../Shared/Components/CustomDialog';
|
|
16
16
|
|
|
17
17
|
const useStyles = makeStyles(
|
|
18
18
|
theme => ({
|
|
@@ -35,7 +35,6 @@ const InvalidConfigurationNotice = ({ validationErrors, show, close, open, admin
|
|
|
35
35
|
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
|
|
36
36
|
const classes = useStyles();
|
|
37
37
|
const initialRender = useRef(true);
|
|
38
|
-
|
|
39
38
|
useEffect(() => {
|
|
40
39
|
if (adminMode || !initialRender.current) {
|
|
41
40
|
validationErrors.length && open();
|
|
@@ -210,7 +210,6 @@ const mapDispatchToProps = () => ({
|
|
|
210
210
|
onSelectableChanged: (identifier, value) =>
|
|
211
211
|
Services.configurator.setSelectedCalculation(identifier, value),
|
|
212
212
|
onClose: () => {
|
|
213
|
-
Services.configurator.resolveCalculationErrors();
|
|
214
213
|
Services.visualization.abortScreenshotting();
|
|
215
214
|
},
|
|
216
215
|
onChangeAmount: amount => Services.configurator.setSelectedAmount(false, amount),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import containerConnect from 'Framework/ComponentContainer';
|
|
2
2
|
import InvalidConfigurationNotice from '../../Components/InvalidConfigurationNotice';
|
|
3
3
|
import { setVisible } from 'App/Reducers/UI/Actions';
|
|
4
|
-
import { getConfiguration } from '
|
|
5
|
-
import { getCached } from '
|
|
4
|
+
import { getConfiguration } from '../../../Reducers/Configurator/Selectors';
|
|
5
|
+
import { getCached } from '../../../../Utils/Function/cached';
|
|
6
6
|
import { getConf } from 'App/configuration';
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Stores the mapped validation errors in cache to keep the same reference if the source has not changed
|
|
9
10
|
* this makes possible to show up the dialog when it gets new list of errors.
|
|
@@ -18,6 +19,28 @@ const getValidationErrors = configuratorState => {
|
|
|
18
19
|
validation,
|
|
19
20
|
optionclassifications && optionclassifications.length
|
|
20
21
|
).use(() => {
|
|
22
|
+
if (validation.code && validation.code === 'minimum_order_amount_error') {
|
|
23
|
+
let errors = [];
|
|
24
|
+
let itemTitle = '';
|
|
25
|
+
validation.errors.forEach((error, index) => {
|
|
26
|
+
itemTitle = error.itemTitle;
|
|
27
|
+
errors.push({
|
|
28
|
+
message: 'minimumOrderAmountError',
|
|
29
|
+
key: index,
|
|
30
|
+
amounts: {
|
|
31
|
+
minAmount: error.minimumAmount,
|
|
32
|
+
selectedAmount: error.selectedAmount,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
title: itemTitle,
|
|
40
|
+
errors,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}
|
|
21
44
|
const errors = validation?.validationErrors || validation?.errors || {};
|
|
22
45
|
return !optionclassifications
|
|
23
46
|
? []
|
/package/src/App/{Modules/Creator → Shared}/Containers/InvalidConfigurationNotice/index.test.js
RENAMED
|
File without changes
|