@configuratorware/configurator-frontendgui 1.33.4 → 1.34.1

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.
@@ -356,6 +356,13 @@ var ImageEditDialog = /*#__PURE__*/function (_React$Component) {
356
356
  }, _callee, null, [[9, 17]]);
357
357
  })));
358
358
 
359
+ _defineProperty(_assertThisInitialized(_this), "getAllowedImageFormats", function () {
360
+ var formats = (0, _configuration.getConf)('designer.allowedImageUploadFormats').split(',');
361
+ return formats ? formats.map(function (format) {
362
+ return ".".concat(format);
363
+ }) : 'image/*';
364
+ });
365
+
359
366
  _this.state = {
360
367
  selectedFile: null,
361
368
  ownershipChecked: false,
@@ -402,6 +409,7 @@ var ImageEditDialog = /*#__PURE__*/function (_React$Component) {
402
409
  className: classes.imageUploadButton
403
410
  }, (0, _i18n.t)('fileUpload.chooseImage'), /*#__PURE__*/_react["default"].createElement("input", {
404
411
  type: "file",
412
+ accept: this.getAllowedImageFormats(),
405
413
  onChange: this.handleInputChange
406
414
  }))), selectedFile !== null && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, imageData && /*#__PURE__*/_react["default"].createElement("img", {
407
415
  className: classes.imagePreview,
@@ -427,6 +435,7 @@ var ImageEditDialog = /*#__PURE__*/function (_React$Component) {
427
435
  className: "".concat(classes.imageUploadButton, " ").concat(classes.imageUploadChangeImageButton)
428
436
  }, /*#__PURE__*/_react["default"].createElement(_Loop["default"], null), " ", (0, _i18n.t)('fileUpload.changeImage'), /*#__PURE__*/_react["default"].createElement("input", {
429
437
  type: "file",
438
+ accept: this.getAllowedImageFormats(),
430
439
  onChange: this.handleInputChange
431
440
  }))))), checkOwnership && /*#__PURE__*/_react["default"].createElement(_FormGroup["default"], {
432
441
  classes: {
@@ -103,11 +103,14 @@ exports.getCurrentVisualizationSettings = getCurrentVisualizationSettings;
103
103
  var visualizationModeCheck = (0, _flow["default"])(getCurrentVisualizationSettings, function (mode) {
104
104
  return {
105
105
  is2D: function is2D() {
106
- return mode === '2dVariant' || mode === '2dLayer' || mode === '2d' || mode === 'layer';
106
+ return mode === '2dVariant' || mode === '2dVariantOverlay' || mode === '2dLayer' || mode === '2d' || mode === 'layer';
107
107
  },
108
108
  is3D: function is3D() {
109
109
  return mode === '3dVariant' || mode === '3dScene' || mode === '3d';
110
110
  },
111
+ is2DOverlay: function is2DOverlay() {
112
+ return mode === '2dVariantOverlay';
113
+ },
111
114
  isDefault: function isDefault() {
112
115
  return mode === 'default';
113
116
  }
@@ -170,10 +170,9 @@ var showVectorizeImageQuality = function showVectorizeImageQuality(imageToAnalys
170
170
 
171
171
  if (imageToAnalyse) {
172
172
  var pixelsInTheImage = (0, _get["default"])(imageToAnalyse, 'original.width', 0) * (0, _get["default"])(imageToAnalyse, 'original.height', 0);
173
- var vectorFormats = ['ai', 'pdf', 'svg', 'eps', 'ps', 'ept'];
174
- var hasVectorFormat = vectorFormats.indexOf((0, _get["default"])(imageToAnalyse, 'original.format', '').toLowerCase()) > -1;
173
+ var hasFormatSVG = (0, _get["default"])(imageToAnalyse, 'original.format', '').toLowerCase() === 'svg';
175
174
  var pixelsOfReference = minimumPixelAmount || (0, _configuration.getConf)('vectorizeImageQuality');
176
- return !hasVectorFormat && pixelsInTheImage < pixelsOfReference;
175
+ return !hasFormatSVG && pixelsInTheImage < pixelsOfReference;
177
176
  }
178
177
 
179
178
  return false;
@@ -197,7 +197,7 @@ var mapStateToProps = function mapStateToProps(state) {
197
197
  var vertical = dock ? dock === 'left' : state.device.screen.orientation === 'landscape';
198
198
  var showAddToCartButton = state.ui.visibilityMap.addToCartButton;
199
199
  var showConfigurationVariantSelection = state.ui.visibilityMap.configurationvariantSelection;
200
- var visualizationOverlayMode = (0, _configuration.getConf)('visualizationOverlayMode');
200
+ var visualizationOverlayMode = (0, _Selectors.visualizationModeCheck)(state).is2DOverlay();
201
201
  var configuration = {
202
202
  showAddToCartButton: (0, _configuration.getConf)('showAddToCartButton'),
203
203
  editCustomTitle: (0, _configuration.getConf)('editCustomTitleBeforeSave'),
@@ -450,8 +450,6 @@ var applySvgContentOperations = function applySvgContentOperations(preview, oper
450
450
 
451
451
  if (svgTags && svgTags[0]) {
452
452
  var svgTag = svgTags[0];
453
- var percentageHeight = /height=["']\d+%["']/;
454
- var percentageWidth = /width=["']\d+%["']/;
455
453
 
456
454
  if (svgTag.indexOf('viewBox=') === -1) {
457
455
  svgContent = svgContent.replace('<svg', "<svg viewBox=\"0 0 ".concat(preview.width, " ").concat(preview.height, "\""));
@@ -464,18 +462,7 @@ var applySvgContentOperations = function applySvgContentOperations(preview, oper
464
462
  if (svgTag.indexOf('width=') === -1) {
465
463
  svgContent = svgContent.replace('<svg', "<svg width=\"".concat(preview.width, "px\""));
466
464
  }
467
-
468
- if (percentageHeight.test(svgTag)) {
469
- svgContent = svgContent.replace(percentageHeight, "height=\"".concat(preview.height, "px\""));
470
- }
471
-
472
- if (percentageWidth.test(svgTag)) {
473
- svgContent = svgContent.replace(percentageWidth, "width=\"".concat(preview.width, "px\""));
474
- }
475
- } // remove doctype if present
476
-
477
-
478
- svgContent = svgContent.replace(/<!DOCTYPE(?:(?!>)[\s\S])*>/gi, '');
465
+ }
479
466
 
480
467
  if (operations && operations.vectorize && operations.vectorizeColorsMap && Object.keys(operations.vectorizeColorsMap).length) {
481
468
  var colorRegex = new RegExp("(".concat(Object.keys(operations.vectorizeColorsMap).join('|'), ")"), 'ig');
@@ -657,12 +657,16 @@ var InteractionService = /*#__PURE__*/function (_AbstractInteractionS) {
657
657
  value: function createPdfUrl() {
658
658
  var documentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'user';
659
659
  var configuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _Selectors.getConfiguration)(_ServiceLocator.Services.configurator.state);
660
+ var queryParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
660
661
 
661
- var params = _Api["default"].getGETParameters();
662
+ var params = _objectSpread(_objectSpread({}, _Api["default"].getGETParameters()), queryParams);
662
663
 
664
+ var customKeys = Object.keys(queryParams);
665
+ var keys = ['_language', '_client', '_channel', '_display_net_prices', '_share_url'];
666
+ var mergedKeys = keys.concat(customKeys);
663
667
  var query = new URLSearchParams(location.search);
664
668
  var queryString = Object.keys(params).filter(function (key) {
665
- return ['_language', '_client', '_channel', '_display_net_prices', '_share_url'].indexOf(key) !== -1;
669
+ return mergedKeys.indexOf(key) !== -1;
666
670
  }).map(function (key) {
667
671
  return key === '_share_url' ? key + '=' + encodeURIComponent(params[key]) : key + '=' + params[key];
668
672
  }).join('&');
@@ -433,7 +433,8 @@ var VisualizationService = /*#__PURE__*/function (_AbstractVisualizatio) {
433
433
 
434
434
  var isAdminMode = (0, _configuration.getConf)('adminMode');
435
435
  (0, _sendMessage["default"])(component, 'clearViewIfEmpty', !!isAdminMode);
436
- var visualizationOverlayMode = (0, _configuration.getConf)('visualizationOverlayMode');
436
+ var state = _ServiceLocator.Services.store.state;
437
+ var visualizationOverlayMode = (0, _Selectors2.visualizationModeCheck)(state).is2DOverlay();
437
438
  (0, _sendMessage["default"])(component, 'setOverlayMode', !!visualizationOverlayMode);
438
439
  var visualizationOptions = (0, _configuration.getConf)('visualization.options');
439
440
  (0, _sendMessage["default"])(component, 'setOptions', visualizationOptions);
@@ -52,7 +52,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
52
52
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
53
53
 
54
54
  var styles = function styles(theme) {
55
- var _MuiFormControlRoot;
55
+ var _MuiFormControlRoot, _checkboxLabel, _checkbox;
56
56
 
57
57
  return {
58
58
  MuiFormControlRoot: (_MuiFormControlRoot = {
@@ -63,13 +63,18 @@ var styles = function styles(theme) {
63
63
  }), _defineProperty(_MuiFormControlRoot, '& label', {
64
64
  fontSize: 15
65
65
  }), _MuiFormControlRoot),
66
- checkboxLabel: _defineProperty({
66
+ checkboxLabel: (_checkboxLabel = {
67
67
  fontSize: 15,
68
68
  paddingLeft: 15,
69
69
  paddingBottom: 12
70
- }, theme.breakpoints.down('xs'), {
71
- paddingLeft: 12
72
- }),
70
+ }, _defineProperty(_checkboxLabel, theme.breakpoints.down('xs'), {
71
+ paddingLeft: 2
72
+ }), _defineProperty(_checkboxLabel, "alignItems", 'start'), _checkboxLabel),
73
+ checkbox: (_checkbox = {
74
+ margin: '0 10px'
75
+ }, _defineProperty(_checkbox, theme.breakpoints.down('xs'), {
76
+ margin: '-12px 0 0 10px'
77
+ }), _defineProperty(_checkbox, "padding", '0'), _checkbox),
73
78
  formHelperText: {
74
79
  marginLeft: 45,
75
80
  marginBottom: 15
@@ -130,7 +135,8 @@ var AcceptDesign = /*#__PURE__*/function (_React$Component) {
130
135
  name: "approval",
131
136
  checked: approval.value,
132
137
  onChange: handleChangeCheckboxApproval,
133
- color: "primary"
138
+ color: "primary",
139
+ className: classes.checkbox
134
140
  }),
135
141
  label: /*#__PURE__*/_react["default"].createElement("span", {
136
142
  dangerouslySetInnerHTML: {
@@ -31,7 +31,7 @@ var DEVELOPMENT_HOST_INT = 'http://int.configuratorware.local'; // eslint-disabl
31
31
  var DEVELOPMENT_HOST_LOCAL = 'http://localhost:10030';
32
32
  var hostsByNodeEnv = {
33
33
  production: '',
34
- development: DEVELOPMENT_HOST_LOCAL,
34
+ development: DEVELOPMENT_HOST_INT,
35
35
  test: ''
36
36
  };
37
37
  var resourceUrlsByNodeEnv = {
@@ -186,9 +186,7 @@ var applicationConfiguration = {
186
186
  // automatically show the vectorization preview in colorizing step
187
187
  autoPreviewVectorization: true,
188
188
  // switch to the previously selected view when selecting a component that has no view specified
189
- switchViewOnComponentSelection: true,
190
- // the visualization behaves like it was a mask over the designer canvas
191
- visualizationOverlayMode: false
189
+ switchViewOnComponentSelection: true
192
190
  };
193
191
  /**
194
192
  * document.domain can be set via a GET Param or is defaulted to
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-frontendgui",
3
- "version": "1.33.4",
3
+ "version": "1.34.1",
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.33.4",
9
+ "@configuratorware/scripts": "1.34.1",
10
10
  "@hot-loader/react-dom": "^17.0.1",
11
11
  "@material-ui/core": "^4.12.2",
12
12
  "@material-ui/icons": "^4.11.2",
@@ -39,8 +39,8 @@
39
39
  "react-router-dom": "^5.2.0",
40
40
  "react-swipeable": "^5.5.1",
41
41
  "react-zoom-pan-pinch": "^2.1.3",
42
- "redhotmagma-graphics-editor": "1.33.4",
43
- "redhotmagma-visualization": "1.33.4",
42
+ "redhotmagma-graphics-editor": "1.34.1",
43
+ "redhotmagma-visualization": "1.34.1",
44
44
  "redux": "^4.1.0",
45
45
  "redux-logger": "^3.0.6",
46
46
  "redux-persist": "^5.10.0",
@@ -287,6 +287,11 @@ class ImageEditDialog extends React.Component {
287
287
  }
288
288
  };
289
289
 
290
+ getAllowedImageFormats = () => {
291
+ const formats = getConf('designer.allowedImageUploadFormats').split(',');
292
+ return formats ? formats.map(format => `.${format}`) : 'image/*';
293
+ };
294
+
290
295
  render() {
291
296
  const { classes, width, checkOwnership } = this.props;
292
297
  const { ownershipChecked, ownershipErrorVisible, selectedFile, error, imageData } = this.state;
@@ -316,7 +321,11 @@ class ImageEditDialog extends React.Component {
316
321
  className={classes.imageUploadButton}
317
322
  >
318
323
  {t('fileUpload.chooseImage')}
319
- <input type="file" onChange={this.handleInputChange} />
324
+ <input
325
+ type="file"
326
+ accept={this.getAllowedImageFormats()}
327
+ onChange={this.handleInputChange}
328
+ />
320
329
  </MainButton>
321
330
  </React.Fragment>
322
331
  )}
@@ -365,7 +374,11 @@ class ImageEditDialog extends React.Component {
365
374
  className={`${classes.imageUploadButton} ${classes.imageUploadChangeImageButton}`}
366
375
  >
367
376
  <LoopIcon /> {t('fileUpload.changeImage')}
368
- <input type="file" onChange={this.handleInputChange} />
377
+ <input
378
+ type="file"
379
+ accept={this.getAllowedImageFormats()}
380
+ onChange={this.handleInputChange}
381
+ />
369
382
  </Button>
370
383
  </React.Fragment>
371
384
  )}
@@ -48,8 +48,14 @@ export const getCurrentVisualizationSettings = createSelector(
48
48
  );
49
49
 
50
50
  export const visualizationModeCheck = flow(getCurrentVisualizationSettings, mode => ({
51
- is2D: () => mode === '2dVariant' || mode === '2dLayer' || mode === '2d' || mode === 'layer',
51
+ is2D: () =>
52
+ mode === '2dVariant' ||
53
+ mode === '2dVariantOverlay' ||
54
+ mode === '2dLayer' ||
55
+ mode === '2d' ||
56
+ mode === 'layer',
52
57
  is3D: () => mode === '3dVariant' || mode === '3dScene' || mode === '3d',
58
+ is2DOverlay: () => mode === '2dVariantOverlay',
53
59
  isDefault: () => mode === 'default',
54
60
  }));
55
61
 
@@ -119,12 +119,10 @@ export const showVectorizeImageQuality = (imageToAnalyse, minimumPixelAmount = n
119
119
  if (imageToAnalyse) {
120
120
  const pixelsInTheImage =
121
121
  get(imageToAnalyse, 'original.width', 0) * get(imageToAnalyse, 'original.height', 0);
122
- const vectorFormats = ['ai', 'pdf', 'svg', 'eps', 'ps', 'ept'];
123
- const hasVectorFormat =
124
- vectorFormats.indexOf(get(imageToAnalyse, 'original.format', '').toLowerCase()) > -1;
122
+ const hasFormatSVG = get(imageToAnalyse, 'original.format', '').toLowerCase() === 'svg';
125
123
  const pixelsOfReference = minimumPixelAmount || getConf('vectorizeImageQuality');
126
124
 
127
- return !hasVectorFormat && pixelsInTheImage < pixelsOfReference;
125
+ return !hasFormatSVG && pixelsInTheImage < pixelsOfReference;
128
126
  }
129
127
  return false;
130
128
  };
@@ -141,7 +141,7 @@ const mapStateToProps = state => {
141
141
  const vertical = dock ? dock === 'left' : state.device.screen.orientation === 'landscape';
142
142
  const showAddToCartButton = state.ui.visibilityMap.addToCartButton;
143
143
  const showConfigurationVariantSelection = state.ui.visibilityMap.configurationvariantSelection;
144
- const visualizationOverlayMode = getConf('visualizationOverlayMode');
144
+ const visualizationOverlayMode = visualizationModeCheck(state).is2DOverlay();
145
145
 
146
146
  const configuration = {
147
147
  showAddToCartButton: getConf('showAddToCartButton'),
@@ -38,6 +38,7 @@ exports[`Screens/DesignerProductPreview/Screen renders the initial image upload
38
38
  >
39
39
  fileUpload.chooseImage
40
40
  <input
41
+ accept=".jpg,.jpeg,.svg,.png,.pdf,.bmp,.tif,.tiff,.eps,.ai,.gif"
41
42
  type="file"
42
43
  />
43
44
  </span>
@@ -397,8 +397,6 @@ export const applySvgContentOperations = (preview, operations, svgContent) => {
397
397
 
398
398
  if (svgTags && svgTags[0]) {
399
399
  const svgTag = svgTags[0];
400
- const percentageHeight = /height=["']\d+%["']/;
401
- const percentageWidth = /width=["']\d+%["']/;
402
400
 
403
401
  if (svgTag.indexOf('viewBox=') === -1) {
404
402
  svgContent = svgContent.replace('<svg', `<svg viewBox="0 0 ${preview.width} ${preview.height}"`);
@@ -411,19 +409,8 @@ export const applySvgContentOperations = (preview, operations, svgContent) => {
411
409
  if (svgTag.indexOf('width=') === -1) {
412
410
  svgContent = svgContent.replace('<svg', `<svg width="${preview.width}px"`);
413
411
  }
414
-
415
- if (percentageHeight.test(svgTag)) {
416
- svgContent = svgContent.replace(percentageHeight, `height="${preview.height}px"`);
417
- }
418
-
419
- if (percentageWidth.test(svgTag)) {
420
- svgContent = svgContent.replace(percentageWidth, `width="${preview.width}px"`);
421
- }
422
412
  }
423
413
 
424
- // remove doctype if present
425
- svgContent = svgContent.replace(/<!DOCTYPE[^>]*>/gis, '');
426
-
427
414
  if (
428
415
  operations &&
429
416
  operations.vectorize &&
@@ -296,15 +296,18 @@ export default class InteractionService extends AbstractInteractionService {
296
296
  }
297
297
  }
298
298
 
299
- createPdfUrl(documentType = 'user', configuration = getConfiguration(Services.configurator.state)) {
300
- const params = Api.getGETParameters();
299
+ createPdfUrl(
300
+ documentType = 'user',
301
+ configuration = getConfiguration(Services.configurator.state),
302
+ queryParams = {}
303
+ ) {
304
+ const params = { ...Api.getGETParameters(), ...queryParams };
305
+ const customKeys = Object.keys(queryParams);
306
+ const keys = ['_language', '_client', '_channel', '_display_net_prices', '_share_url'];
307
+ const mergedKeys = keys.concat(customKeys);
301
308
  const query = new URLSearchParams(location.search);
302
309
  let queryString = Object.keys(params)
303
- .filter(
304
- key =>
305
- ['_language', '_client', '_channel', '_display_net_prices', '_share_url'].indexOf(key) !==
306
- -1
307
- )
310
+ .filter(key => mergedKeys.indexOf(key) !== -1)
308
311
  .map(key =>
309
312
  key === '_share_url' ? key + '=' + encodeURIComponent(params[key]) : key + '=' + params[key]
310
313
  )
@@ -264,7 +264,8 @@ export default class VisualizationService extends AbstractVisualizationService {
264
264
  const isAdminMode = getConf('adminMode');
265
265
  sendMessage(component, 'clearViewIfEmpty', !!isAdminMode);
266
266
 
267
- const visualizationOverlayMode = getConf('visualizationOverlayMode');
267
+ const state = Services.store.state;
268
+ const visualizationOverlayMode = visualizationModeCheck(state).is2DOverlay();
268
269
  sendMessage(component, 'setOverlayMode', !!visualizationOverlayMode);
269
270
 
270
271
  const visualizationOptions = getConf('visualization.options');
@@ -1,3 +1,4 @@
1
+ /* eslint-disable prettier/prettier */
1
2
  import React from 'react';
2
3
  import { withStyles } from '@material-ui/core/styles';
3
4
  import { t } from 'Framework/i18n';
@@ -25,8 +26,16 @@ const styles = theme => ({
25
26
  paddingLeft: 15,
26
27
  paddingBottom: 12,
27
28
  [theme.breakpoints.down('xs')]: {
28
- paddingLeft: 12,
29
+ paddingLeft: 2,
29
30
  },
31
+ alignItems: 'start',
32
+ },
33
+ checkbox: {
34
+ margin: '0 10px',
35
+ [theme.breakpoints.down('xs')]: {
36
+ margin: '-12px 0 0 10px',
37
+ },
38
+ padding: '0',
30
39
  },
31
40
  formHelperText: {
32
41
  marginLeft: 45,
@@ -91,6 +100,7 @@ class AcceptDesign extends React.Component {
91
100
  checked={approval.value}
92
101
  onChange={handleChangeCheckboxApproval}
93
102
  color="primary"
103
+ className={classes.checkbox}
94
104
  />
95
105
  }
96
106
  label={
@@ -13,7 +13,7 @@ const DEVELOPMENT_HOST_LOCAL = 'http://localhost:10030';
13
13
 
14
14
  const hostsByNodeEnv = {
15
15
  production: '',
16
- development: DEVELOPMENT_HOST_LOCAL,
16
+ development: DEVELOPMENT_HOST_INT,
17
17
  test: '',
18
18
  };
19
19
 
@@ -205,9 +205,6 @@ let applicationConfiguration = {
205
205
 
206
206
  // switch to the previously selected view when selecting a component that has no view specified
207
207
  switchViewOnComponentSelection: true,
208
-
209
- // the visualization behaves like it was a mask over the designer canvas
210
- visualizationOverlayMode: false,
211
208
  };
212
209
 
213
210
  /**