@configuratorware/configurator-frontendgui 1.29.5 → 1.30.2

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.
Files changed (32) hide show
  1. package/App/Modules/Creator/Components/Option/index.js +2 -2
  2. package/App/Modules/Creator/Components/OptionsList/index.js +54 -28
  3. package/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +3 -3
  4. package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +5 -7
  5. package/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +1 -1
  6. package/App/Modules/Designer/Components/ImageEditDialog/index.js +3 -1
  7. package/App/Modules/Designer/Containers/ImageEditDialog.js +169 -116
  8. package/App/Modules/Designer/Utils/SvgFixers.js +59 -0
  9. package/App/Modules/Designer/Utils/Transformers.js +17 -10
  10. package/App/Reducers/ImageGallery/Selectors.js +7 -10
  11. package/App/Services/AnalyticsService.js +13 -64
  12. package/App/Services/ConfiguratorService.js +4 -2
  13. package/App/Services/DesignDataService.js +125 -138
  14. package/package.json +4 -4
  15. package/src/App/Modules/Creator/Components/Option/__snapshots__/index.test.js.snap +2 -2
  16. package/src/App/Modules/Creator/Components/Option/index.js +12 -2
  17. package/src/App/Modules/Creator/Components/OptionsList/index.js +46 -32
  18. package/src/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +2 -5
  19. package/src/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.test.js +1 -0
  20. package/src/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +5 -8
  21. package/src/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +1 -1
  22. package/src/App/Modules/Designer/Components/ImageEditDialog/index.js +3 -1
  23. package/src/App/Modules/Designer/Containers/ImageEditDialog.js +39 -12
  24. package/src/App/Modules/Designer/Utils/SvgFixers.js +36 -0
  25. package/src/App/Modules/Designer/Utils/Transformers.js +7 -3
  26. package/src/App/Modules/Designer/Utils/__tests__/Transformers.test.js +2 -2
  27. package/src/App/Reducers/ImageGallery/Selectors.js +5 -5
  28. package/src/App/Reducers/ImageGallery/__tests__/Selectors.test.js +0 -13
  29. package/src/App/Services/AnalyticsService.js +7 -20
  30. package/src/App/Services/ConfiguratorService.js +3 -2
  31. package/src/App/Services/DesignDataService.js +39 -24
  32. package/src/App/Services/__tests__/AnalyticsService.test.js +24 -37
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-frontendgui",
3
- "version": "1.29.5",
3
+ "version": "1.30.2",
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.29.5",
9
+ "@configuratorware/scripts": "1.30.2",
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.29.5",
43
- "redhotmagma-visualization": "1.29.5",
42
+ "redhotmagma-graphics-editor": "1.30.2",
43
+ "redhotmagma-visualization": "1.30.2",
44
44
  "redux": "^4.1.0",
45
45
  "redux-logger": "^3.0.6",
46
46
  "redux-persist": "^5.10.0",
@@ -128,7 +128,7 @@ exports[`Option renders with Incompatibility link 1`] = `
128
128
  >
129
129
  <svg
130
130
  aria-hidden="true"
131
- class="MuiSvgIcon-root Option-materialIcon-50"
131
+ class="MuiSvgIcon-root Option-materialIcon-50 custom-css-rule-info-icon-option"
132
132
  focusable="false"
133
133
  viewBox="0 0 24 24"
134
134
  >
@@ -397,7 +397,7 @@ exports[`Option renders with details 1`] = `
397
397
  >
398
398
  <svg
399
399
  aria-hidden="true"
400
- class="MuiSvgIcon-root Option-materialIcon-39"
400
+ class="MuiSvgIcon-root Option-materialIcon-39 custom-css-rule-info-icon-option"
401
401
  focusable="false"
402
402
  viewBox="0 0 24 24"
403
403
  >
@@ -357,7 +357,12 @@ const Option = ({ children, render, ...props }) => {
357
357
  {displayDetails && (
358
358
  <div>
359
359
  <a className={classes.iconWithText} onClick={onDetailsClicked}>
360
- <InfoRoundedIcon className={classes.materialIcon} />
360
+ <InfoRoundedIcon
361
+ className={clsx(
362
+ classes.materialIcon,
363
+ customClassName('rule-info-icon-option')
364
+ )}
365
+ />
361
366
  <Typography variant={'body2'} className={classes.iconWithText}>
362
367
  {translations.details}
363
368
  </Typography>
@@ -368,7 +373,12 @@ const Option = ({ children, render, ...props }) => {
368
373
  {resultStatus !== true && (
369
374
  <div>
370
375
  <a className={classes.iconWithText} onClick={onIncompatibilityClicked}>
371
- <WarningRoundedIcon className={classes.materialIcon} />
376
+ <WarningRoundedIcon
377
+ className={clsx(
378
+ classes.materialIcon,
379
+ customClassName('rule-alert-icon-option')
380
+ )}
381
+ />
372
382
  <Typography variant={'body2'}>{translations.incompatibility}</Typography>
373
383
  </a>
374
384
  </div>
@@ -56,22 +56,24 @@ const useStyles = makeStyles(
56
56
  }
57
57
  );
58
58
 
59
- const OptionsList = ({
60
- addCheckedOptionclassification,
61
- children,
62
- isLoading,
63
- onClose,
64
- onSelect,
65
- onToggle,
66
- optionclassification,
67
- options,
68
- show,
69
- viewDetails,
70
- viewStockInformation,
71
- LoadingComponent,
72
- OptionComponent,
73
- isAdminMode,
74
- }) => {
59
+ const OptionsList = ({ render, ...props }) => {
60
+ const {
61
+ addCheckedOptionclassification,
62
+ children,
63
+ isLoading,
64
+ onClose,
65
+ onSelect,
66
+ onToggle,
67
+ optionclassification,
68
+ options,
69
+ show,
70
+ viewDetails,
71
+ viewStockInformation,
72
+ LoadingComponent,
73
+ OptionComponent,
74
+ isAdminMode,
75
+ } = props;
76
+
75
77
  const classes = useStyles();
76
78
 
77
79
  const createOptions = () => {
@@ -130,22 +132,33 @@ const OptionsList = ({
130
132
  );
131
133
  };
132
134
 
133
- return (
134
- <CustomDialog
135
- className={clsx(classes.dialogStyle, customClassName('options'))}
136
- dialogTitle={optionclassification.title}
137
- onCancel={onClose}
138
- onClose={onClose}
139
- open={show && !!optionclassification.identifier}
140
- BackdropProps={{
141
- classes: {
142
- root: classes.backDrop,
143
- },
144
- }}
145
- >
146
- <DialogContent className={classes.contentStyle}>{renderOptions()}</DialogContent>
147
- </CustomDialog>
148
- );
135
+ const renderOptionsList = () => {
136
+ return (
137
+ <CustomDialog
138
+ className={clsx(classes.dialogStyle, customClassName('options'))}
139
+ dialogTitle={optionclassification.title}
140
+ onCancel={onClose}
141
+ onClose={onClose}
142
+ open={show && !!optionclassification.identifier}
143
+ BackdropProps={{
144
+ classes: {
145
+ root: classes.backDrop,
146
+ },
147
+ }}
148
+ >
149
+ <DialogContent className={classes.contentStyle}>{renderOptions()}</DialogContent>
150
+ </CustomDialog>
151
+ );
152
+ };
153
+
154
+ const getRenderProps = () => ({
155
+ ...props,
156
+ renderOptions,
157
+ createOptions,
158
+ renderOptionsList,
159
+ });
160
+
161
+ return typeof render === 'function' ? render(getRenderProps()) : renderOptionsList();
149
162
  };
150
163
 
151
164
  OptionsList.defaultProps = {
@@ -178,6 +191,7 @@ OptionsList.propTypes = {
178
191
  LoadingComponent: PropTypes.elementType,
179
192
  OptionComponent: PropTypes.elementType,
180
193
  isAdminMode: PropTypes.bool,
194
+ render: PropTypes.func,
181
195
  };
182
196
 
183
197
  export default OptionsList;
@@ -1,7 +1,6 @@
1
1
  import React, { useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import isEmpty from 'lodash/isEmpty';
4
- import get from 'lodash/get';
5
4
  import cloneDeep from 'lodash/cloneDeep';
6
5
  import withStyles from '@material-ui/core/styles/withStyles';
7
6
  import withWidth from '@material-ui/core/withWidth/withWidth';
@@ -15,6 +14,7 @@ import { isPlaceholderContent } from 'App/Reducers/DesignArea/Selectors';
15
14
  import isMobileDevice from 'Framework/Helpers/isMobileDevice';
16
15
  import { hasBackgroundColor } from 'App/Reducers/DesignData/Selectors';
17
16
  import { t } from 'Framework/i18n';
17
+ import { isOriginalVector } from '../../Utils/Transformers';
18
18
 
19
19
  const styles = theme => ({
20
20
  root: {
@@ -98,10 +98,7 @@ const handleObjectButtonClick = (evt, canvas, onMoveUpClick, onMoveDownClick) =>
98
98
  };
99
99
 
100
100
  export const isOriginallyVector = object =>
101
- (object &&
102
- object.type === 'Image' &&
103
- /^(eps|pdf|ai|svg)$/i.test(get(object, 'imageData.original.format', ''))) ||
104
- false;
101
+ (object && object.type === 'Image' && isOriginalVector(object.imageData)) || false;
105
102
 
106
103
  const isRaster = object =>
107
104
  (object && object.type === 'Image' && /\.(jpe?g|png|gif)$/i.test(object.src)) || false;
@@ -23,6 +23,7 @@ describe('Designer/DesignerSelectionToolbox', () => {
23
23
  const createObject = (type, format) => ({ type, imageData: { original: { format } } });
24
24
 
25
25
  expect(isOriginallyVector(createObject('Image', 'eps'))).toEqual(true);
26
+ expect(isOriginallyVector(createObject('Image', 'ept'))).toEqual(true);
26
27
  expect(isOriginallyVector(createObject('Image', 'pdf'))).toEqual(true);
27
28
  expect(isOriginallyVector(createObject('Image', 'ai'))).toEqual(true);
28
29
  expect(isOriginallyVector(createObject('Image', 'svg'))).toEqual(true);
@@ -210,17 +210,14 @@ export class ImageColorPicker extends React.Component {
210
210
  const { width: pw, height: ph } = container.getBoundingClientRect();
211
211
  const { width: ow, height: oh } = img;
212
212
 
213
- const pa = pw / ph;
214
- const oa = ow / oh;
215
-
216
- if (pa >= oa) {
217
- const height = Math.min(ph, oh);
218
- const width = (height * ow) / oh;
213
+ if (ow / oh <= pw / ph) {
214
+ const height = ph;
215
+ const width = height * (ow / oh);
219
216
 
220
217
  this.updateCanvasDimensionsAndContent(canvas, img, width, height);
221
218
  } else {
222
- const width = Math.min(pw, ow);
223
- const height = (width * oh) / ow;
219
+ const width = pw;
220
+ const height = width * (oh / ow);
224
221
 
225
222
  this.updateCanvasDimensionsAndContent(canvas, img, width, height);
226
223
  }
@@ -52,7 +52,7 @@ class ImageThumbnail extends React.Component {
52
52
  }
53
53
 
54
54
  if (!image.displayColorPreview && !image.gallery) {
55
- return getRasterURL(image.preview.url);
55
+ return getRasterURL(getPreviewUrlFromImageData(image.thumbnail));
56
56
  }
57
57
 
58
58
  this.downloadSvg(image);
@@ -32,6 +32,7 @@ import ColorPicker from '../ImageColorPicker/ImageColorPicker';
32
32
  import ImageThumbnail from './ImageThumbnail';
33
33
  import colorizeIcon from './res/baseline_colorize_black_24dp.png';
34
34
  import checkers from './res/checkers_tile.png';
35
+ import { isOriginalVector } from '../../Utils/Transformers';
35
36
 
36
37
  const styles = theme => ({
37
38
  dialogContent: {
@@ -499,7 +500,8 @@ class ImageEditDialog extends React.Component {
499
500
  src={
500
501
  [0, 2].includes(activeTabIndex) &&
501
502
  !displayColorPreview &&
502
- !image.gallery
503
+ !image.gallery &&
504
+ !isOriginalVector(image)
503
505
  ? originalImagePreview
504
506
  : preview
505
507
  }
@@ -51,7 +51,7 @@ import createSelector from 'Utils/Function/createSelector';
51
51
  import { getConf } from 'App/configuration';
52
52
  import { EventTypes } from 'App/Constant';
53
53
  import { expandVectorizeColorsMap, getClosestColorFromMap } from '../Utils/ImageEditUtils';
54
- import { getRasterURL } from '../Utils/Transformers';
54
+ import { getRasterURL, isOriginalVector } from '../Utils/Transformers';
55
55
 
56
56
  const getOperationsFromState = state => {
57
57
  const { clipping, clippingColor, vectorize, vectorizeThreshold, vectorizeColorsMap } = state;
@@ -197,12 +197,10 @@ export class ImageEditDialogContainer extends React.Component {
197
197
  image.preview &&
198
198
  image.preview.url &&
199
199
  activeTabIndex === 2 &&
200
- originalImagePreview === null
200
+ originalImagePreview === null &&
201
+ !isOriginalVector(image)
201
202
  ) {
202
- const previewUrl = `${getConf('network.host')}${image.preview.url}`;
203
- this.setState({
204
- originalImagePreview: image.gallery ? previewUrl : previewUrl.replace(/.svg$/, '.png'),
205
- });
203
+ this.updateOriginalPreview();
206
204
  }
207
205
 
208
206
  if (operationsChanged) {
@@ -285,6 +283,24 @@ export class ImageEditDialogContainer extends React.Component {
285
283
  }
286
284
  }
287
285
 
286
+ updateOriginalPreview = async () => {
287
+ const { image } = this.props;
288
+ const previewUrl = `${getConf('network.host')}${image.preview.url}`;
289
+ const isSvg = previewUrl && /\.svg$/.test(previewUrl);
290
+ if (isSvg) {
291
+ const svgContent = await getSvgContent(previewUrl, true);
292
+ const preview = applySvgContentOperations(image.preview, null, svgContent);
293
+
294
+ this.setState({
295
+ originalImagePreview: preview,
296
+ });
297
+ } else {
298
+ this.setState({
299
+ originalImagePreview: previewUrl,
300
+ });
301
+ }
302
+ };
303
+
288
304
  setUpload = upload => {
289
305
  this.setState({ upload });
290
306
  };
@@ -471,25 +487,33 @@ export class ImageEditDialogContainer extends React.Component {
471
487
  let preview = null;
472
488
  let originalImagePreview = null;
473
489
 
490
+ let previewUrl = image?.preview?.url;
491
+ if (previewUrl && activeTabIndex === 1) {
492
+ previewUrl = getRasterURL(previewUrl);
493
+ }
494
+
495
+ const isSvg = previewUrl && /\.svg$/.test(previewUrl);
496
+
474
497
  if (image) {
475
- const updateSVG =
476
- activeTabIndex !== 1 &&
477
- (image.displayColorPreview || image.gallery) &&
478
- isEditableVectorImage(image.preview);
498
+ const updateSVG = isSvg;
479
499
 
480
500
  if (updateSVG) {
481
501
  if (!svgContent) {
482
502
  svgContent = await getSvgContent(image.preview.url, false, forceFetch);
483
503
  }
484
504
 
485
- preview = applySvgContentOperations(image.preview, image.operations, svgContent);
505
+ preview = applySvgContentOperations(
506
+ image.preview,
507
+ image.displayColorPreview ? image.operations : null,
508
+ svgContent
509
+ );
486
510
  } else {
487
511
  const forceUpdate = isImageInvalidatedByChange(this.lastImageUpdateData, image);
488
512
  if (forceUpdate) {
489
513
  this.previewVersion = Math.random();
490
514
  }
491
515
  preview =
492
- getRasterURL(getPreviewUrlFromImageData(image.preview)) +
516
+ getPreviewUrlFromImageData(previewUrl) +
493
517
  (this.previewVersion ? `?${this.previewVersion}` : '');
494
518
  originalImagePreview = preview;
495
519
  }
@@ -625,6 +649,7 @@ export class ImageEditDialogContainer extends React.Component {
625
649
  ImageUploadComponent,
626
650
  customControlElements,
627
651
  checkOwnership,
652
+ designProductionMethod,
628
653
  } = this.props;
629
654
  const {
630
655
  preview,
@@ -694,6 +719,7 @@ export class ImageEditDialogContainer extends React.Component {
694
719
  vectorsRequired={vectorsRequired}
695
720
  colorAmountList={colorAmountList}
696
721
  customControlElements={customControlElements}
722
+ designProductionMethodName={designProductionMethod?.title}
697
723
  />
698
724
  }
699
725
  activeTabIndex={activeTabIndex}
@@ -794,6 +820,7 @@ const mapStateToProps = state => {
794
820
  hasPlaceHolderImage,
795
821
  initialColorMaxAmount,
796
822
  colorPreviewRequirementFulfilled,
823
+ designProductionMethod,
797
824
  };
798
825
  };
799
826
 
@@ -0,0 +1,36 @@
1
+ export const getMatchAt = (str, regexp, idx = 1, defaultValue = '') => {
2
+ const matches = ('' + str).match(regexp);
3
+ return (matches && matches[idx]) || defaultValue;
4
+ };
5
+
6
+ export const embeddedSvgImageToInlineSvgContent = svgStr =>
7
+ svgStr.replace(/<image([^>]+)xlink:href="data:image\/svg\+xml;base64,([^"]+)"[^>]*>/g, function(
8
+ _,
9
+ attributesStr,
10
+ base64Str
11
+ ) {
12
+ const x = getMatchAt(attributesStr, /x="([^"]+)"/, 1, 0);
13
+ const y = getMatchAt(attributesStr, /y="([^"]+)"/, 1, 0);
14
+ const transform = getMatchAt(attributesStr, /transform="([^"]+)"/, 1, '');
15
+ const svgContent = atob(base64Str).replace(/(<\?xml[^>]+>)|(<!--[^>]+-->)/gi, '');
16
+ return `<g transform="${transform} translate(${x},${y})">${svgContent}</g>`;
17
+ });
18
+
19
+ export const alterObjectValues = (obj, fn) => {
20
+ Object.keys(obj).forEach(key => {
21
+ obj[key] = fn(obj[key], key);
22
+ });
23
+ return obj;
24
+ };
25
+
26
+ export const alterArrayValues = (arr, fn) => {
27
+ arr.forEach((value, key) => {
28
+ arr[key] = fn(value, key);
29
+ });
30
+ return arr;
31
+ };
32
+
33
+ export const prepareDesignDataSnapshots = svgArrMap =>
34
+ alterObjectValues(svgArrMap, arr => alterArrayValues(arr, embeddedSvgImageToInlineSvgContent));
35
+
36
+ export const preparePrintDesignData = svgMap => alterObjectValues(svgMap, embeddedSvgImageToInlineSvgContent);
@@ -19,6 +19,9 @@ export const fixSrcURL = src => {
19
19
 
20
20
  export const getRasterURL = imageURL => ('' + imageURL).replace(/svg$/, 'png');
21
21
 
22
+ export const isOriginalVector = imageData =>
23
+ /^(eps|ept|ps|pdf|ai|svg)$/i.test(get(imageData, 'original.format', ''));
24
+
22
25
  export const noCache = src => `${src}?${Math.random()}`;
23
26
 
24
27
  export const prepareImageObjectData = rawObject => {
@@ -29,21 +32,22 @@ export const prepareImageObjectData = rawObject => {
29
32
  src: fixSrcURL(rawObject.src),
30
33
  };
31
34
 
32
- data.transformImageSrc = async (url, { preview, operations } = {}) => {
35
+ data.transformImageSrc = async (url, { operations } = {}) => {
33
36
  if (!isEditableVectorImage({ url })) {
34
37
  return noCache(url);
35
38
  }
36
39
 
37
40
  const { displayColorPreview, gallery, isPlaceHolderImage } = image;
41
+ const originalVector = isOriginalVector(image);
38
42
 
39
- if (!displayColorPreview && !gallery && !isPlaceHolderImage) {
43
+ if (!originalVector && !displayColorPreview && !gallery && !isPlaceHolderImage) {
40
44
  return noCache(fixSrcURL(getRasterURL(get(image, 'preview.url', ''))));
41
45
  }
42
46
 
43
47
  const svgContent = await getSvgContent(url, true);
44
48
 
45
49
  return applySvgContentOperations(
46
- preview ? preview : image.preview,
50
+ image.preview,
47
51
  displayColorPreview || gallery ? (operations ? operations : image.operations) : null,
48
52
  svgContent
49
53
  );
@@ -94,7 +94,7 @@ describe('App/Modules/Designer/Utils/Transformers', () => {
94
94
  expect(transformedSrc).toBe('base64encodedSVG');
95
95
  });
96
96
 
97
- it('transformImageSrc uses the raster image if color preview is disabled but the original format is SVG', async () => {
97
+ it('transformImageSrc uses the SVG image if color preview is disabled but the original format is SVG', async () => {
98
98
  DesignDataHelpers.getSvgContent.mockResolvedValue('<svg></svg>');
99
99
  DesignDataHelpers.applySvgContentOperations.mockReturnValue('base64encodedSVG');
100
100
  const currentSrc = 'path/to/image.svg';
@@ -113,7 +113,7 @@ describe('App/Modules/Designer/Utils/Transformers', () => {
113
113
  };
114
114
  const preparedImageData = prepareImageObjectData(imageObjectData);
115
115
  const transformedSrc = await preparedImageData.transformImageSrc(currentSrc);
116
- expect(transformedSrc.indexOf('path/to/image.png')).toBe(0);
116
+ expect(transformedSrc).toBe('base64encodedSVG');
117
117
  });
118
118
 
119
119
  it('transformImageSrc applies the operations (vectorizeColorsMap) on gallery images', async () => {
@@ -1,5 +1,6 @@
1
1
  import get from 'lodash/get';
2
2
  import find from 'lodash/find';
3
+ import isString from 'lodash/isString';
3
4
  import flatten from 'lodash/flatten';
4
5
  import { getConf } from '../../configuration';
5
6
  import { getConfiguration, getConfigurator } from '../Configurator/Selectors';
@@ -15,11 +16,12 @@ import {
15
16
  import isEqual from 'lodash/isEqual';
16
17
 
17
18
  export const getPreviewUrlFromImageData = (preview, options = {}) => {
18
- if (/^data:image/.test(preview.url)) {
19
- return preview.url;
19
+ const previewUrl = isString(preview) ? preview : preview.url;
20
+ if (/^data:image/.test(previewUrl)) {
21
+ return previewUrl;
20
22
  }
21
23
  const { host = getConf('network.host', '') } = options;
22
- return `${host}${preview.url}`;
24
+ return `${host}${previewUrl}`;
23
25
  };
24
26
 
25
27
  export const isEditableVectorImage = preview => {
@@ -113,8 +115,6 @@ export const isColorMappingCompatible = (colorPalettes, vectorizeColorsMap) => {
113
115
  );
114
116
  };
115
117
 
116
- export const isVectorFormat = extension => /^(eps|pdf|ai|svg)$/i.test(extension);
117
-
118
118
  export const showVectorizeImageQuality = (imageToAnalyse, minimumPixelAmount = null) => {
119
119
  if (imageToAnalyse) {
120
120
  const pixelsInTheImage =
@@ -8,7 +8,6 @@ import {
8
8
  isImageCompatible,
9
9
  isImageReadyToBeAdded,
10
10
  showVectorizeImageQuality,
11
- isVectorFormat,
12
11
  isHardModified,
13
12
  isColorPreviewCompatible,
14
13
  getPreviewUrlFromImageData,
@@ -624,18 +623,6 @@ describe('Reducers/ImageGallery/Selectors', () => {
624
623
  });
625
624
  });
626
625
 
627
- test('isVectorFormat returns true for known vector formats, otherwise false', () => {
628
- [
629
- ['eps', true],
630
- ['pdf', true],
631
- ['ai', true],
632
- ['svg', true],
633
- ['png', false],
634
- ['jpg', false],
635
- ['gif', false],
636
- ].forEach(([format, expectedValue]) => expect(isVectorFormat(format)).toBe(expectedValue));
637
- });
638
-
639
626
  test('isHardModified returns true if the related props are changed', () => {
640
627
  expect(
641
628
  isHardModified(
@@ -356,34 +356,21 @@ export default class AnalyticsService {
356
356
 
357
357
  EventTypes = EventTypes;
358
358
 
359
- async setDataLayer(dataLayer) {
360
- await Services.store.addMiddleware(this.createMiddleware(dataLayer));
359
+ setDataLayer(dataLayer) {
360
+ this.dataLayer = dataLayer;
361
361
  const loadIdentifier = Services.configurator.state.loadIdentifier;
362
362
  loadIdentifier && this.triggerEvent(EventTypes.load_item, Services.configurator.state.loadIdentifier);
363
363
  }
364
364
 
365
- createMiddleware(dataLayer) {
366
- return store => next => action => {
367
- const result = next(action);
368
-
369
- const actionsToTrack = this.getActionsToTrack();
370
- if (!actionsToTrack[action.type]) {
371
- return result;
372
- }
373
- const nextState = store.getState();
374
- if (action.type) {
375
- const data = actionsToTrack[action.type](action, nextState);
376
- dataLayer.push(data);
377
- }
378
- return result;
379
- };
380
- }
381
-
382
365
  getActionsToTrack() {
383
366
  return actionsToTrack;
384
367
  }
385
368
 
386
369
  triggerEvent(type, data = {}) {
387
- Services.store.dispatch({ type, data });
370
+ const actionsToTrack = this.getActionsToTrack();
371
+ if (type && actionsToTrack[type]) {
372
+ const gaData = actionsToTrack[type]({ type, data }, Services.store.state);
373
+ this.dataLayer && this.dataLayer.push(gaData);
374
+ }
388
375
  }
389
376
  }
@@ -44,6 +44,7 @@ import createMessageInterface, {
44
44
  METHOD_ADD_TO_CART,
45
45
  METHOD_CONFIGURATION_SAVED_REMOTELY,
46
46
  } from '../Utils/createMessageInterface';
47
+ import { prepareDesignDataSnapshots, preparePrintDesignData } from '../Modules/Designer/Utils/SvgFixers';
47
48
 
48
49
  const getSelectedAmountsBySizes = (item, selectedAmounts) => {
49
50
  const itemGroupMap = (rootItem, fn) => {
@@ -363,10 +364,10 @@ export default class ConfiguratorService extends AbstractConfiguratorService {
363
364
  const fontMapping = getFontMapping(Services.store.state);
364
365
 
365
366
  const svgs = await Services.designData.getScreenshotsOfElements(fontMapping);
366
- mediaData.designDataSnapshots = svgs;
367
+ mediaData.designDataSnapshots = prepareDesignDataSnapshots(svgs);
367
368
 
368
369
  const fullSvgs = await Services.designData.getScreenshots(fontMapping);
369
- mediaData.printDesignData = fullSvgs;
370
+ mediaData.printDesignData = preparePrintDesignData(fullSvgs);
370
371
  const usedAreas = Object.keys(fullSvgs);
371
372
 
372
373
  const { designArea } = Services.store.state;