@configuratorware/configurator-frontendgui 1.40.4 → 1.40.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App/Modules/Designer/Containers/ImageEditDialog.js +10 -28
- package/App/Reducers/DesignArea/Selectors.js +11 -44
- package/App/Reducers/DesignData/Modifiers.js +1 -3
- package/App/Reducers/ImageGallery/Actions.js +18 -25
- package/App/Reducers/ImageGallery/Reducer.js +0 -5
- package/App/Reducers/ImageGallery/Selectors.js +1 -1
- package/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +9 -10
- package/App/Services/DesignDataService.js +435 -494
- package/App/configuration.js +1 -1
- package/package.json +4 -4
- package/src/App/Modules/Designer/Containers/ImageEditDialog.js +6 -33
- package/src/App/Reducers/DesignArea/Selectors.js +9 -39
- package/src/App/Reducers/DesignArea/__tests__/Selectors.test.js +0 -19
- package/src/App/Reducers/DesignData/Modifiers.js +0 -3
- package/src/App/Reducers/ImageGallery/Actions.js +5 -20
- package/src/App/Reducers/ImageGallery/Reducer.js +0 -5
- package/src/App/Reducers/ImageGallery/Selectors.js +3 -4
- package/src/App/Reducers/ImageGallery/__tests__/Actions.test.js +7 -81
- package/src/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +1 -4
- package/src/App/Services/DesignDataService.js +16 -56
- package/src/App/configuration.js +1 -1
package/App/configuration.js
CHANGED
|
@@ -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:
|
|
34
|
+
development: DEVELOPMENT_HOST_INT,
|
|
35
35
|
test: ''
|
|
36
36
|
};
|
|
37
37
|
var resourceUrlsByNodeEnv = {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-frontendgui",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.5",
|
|
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.40.
|
|
9
|
+
"@configuratorware/scripts": "1.40.5",
|
|
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.40.
|
|
43
|
-
"redhotmagma-visualization": "1.40.
|
|
42
|
+
"redhotmagma-graphics-editor": "1.40.5",
|
|
43
|
+
"redhotmagma-visualization": "1.40.5",
|
|
44
44
|
"redux": "^4.1.0",
|
|
45
45
|
"redux-logger": "^3.0.6",
|
|
46
46
|
"redux-persist": "^5.10.0",
|
|
@@ -97,7 +97,6 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
97
97
|
open: PropTypes.bool,
|
|
98
98
|
editMode: PropTypes.bool,
|
|
99
99
|
vectorsRequired: PropTypes.bool,
|
|
100
|
-
vectorizedLogoMandatory: PropTypes.bool,
|
|
101
100
|
colorDisabled: PropTypes.bool,
|
|
102
101
|
loading: PropTypes.bool,
|
|
103
102
|
errorCode: PropTypes.string,
|
|
@@ -181,7 +180,6 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
181
180
|
isImageCompatible,
|
|
182
181
|
isColorMappingCompatible,
|
|
183
182
|
vectorsRequired,
|
|
184
|
-
vectorizedLogoMandatory,
|
|
185
183
|
} = this.props;
|
|
186
184
|
|
|
187
185
|
const { vectorize, vectorizeColorsMap, activeTabIndex, originalImagePreview } = this.state;
|
|
@@ -258,32 +256,13 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
258
256
|
Object.assign(newState, { vectorizeColorsMap });
|
|
259
257
|
}
|
|
260
258
|
|
|
261
|
-
if (
|
|
262
|
-
activeTabIndex === 2 &&
|
|
263
|
-
(vectorsRequired || vectorizedLogoMandatory) &&
|
|
264
|
-
!vectorize &&
|
|
265
|
-
!image.gallery
|
|
266
|
-
) {
|
|
259
|
+
if (activeTabIndex === 2 && vectorsRequired && !vectorize && !image.gallery) {
|
|
267
260
|
Object.assign(newState, {
|
|
268
261
|
vectorize: true,
|
|
269
262
|
});
|
|
270
263
|
}
|
|
271
264
|
|
|
272
|
-
|
|
273
|
-
if (
|
|
274
|
-
activeTabIndex === 2 &&
|
|
275
|
-
!image.gallery &&
|
|
276
|
-
vectorizedLogoMandatory &&
|
|
277
|
-
!image.displayColorPreview &&
|
|
278
|
-
!this.state.displayColorPreview
|
|
279
|
-
) {
|
|
280
|
-
options = { displayColorPreview: true };
|
|
281
|
-
Object.assign(newState, {
|
|
282
|
-
displayColorPreview: true,
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
(!isMatch(this.state, newState) || options) && this.handleStateChange(newState, options);
|
|
265
|
+
!isMatch(this.state, newState) && this.handleStateChange(newState);
|
|
287
266
|
|
|
288
267
|
if ((justOpened || imageChanged) && !image.incomplete) {
|
|
289
268
|
this.updatePreview(null, { forceFetch: operationsChanged });
|
|
@@ -535,12 +514,10 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
535
514
|
if (forceUpdate) {
|
|
536
515
|
this.previewVersion = Math.random();
|
|
537
516
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
originalImagePreview = preview;
|
|
543
|
-
}
|
|
517
|
+
preview =
|
|
518
|
+
getPreviewUrlFromImageData(previewUrl) +
|
|
519
|
+
(this.previewVersion ? `?${this.previewVersion}` : '');
|
|
520
|
+
originalImagePreview = preview;
|
|
544
521
|
}
|
|
545
522
|
}
|
|
546
523
|
|
|
@@ -664,7 +641,6 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
664
641
|
maxColorAmount,
|
|
665
642
|
colorDisabled,
|
|
666
643
|
vectorsRequired,
|
|
667
|
-
vectorizedLogoMandatory,
|
|
668
644
|
image,
|
|
669
645
|
usedColors,
|
|
670
646
|
imageColorsWereEdited,
|
|
@@ -704,7 +680,6 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
704
680
|
activeTabIndex === 2 &&
|
|
705
681
|
colorCount > 0 &&
|
|
706
682
|
!isGalleryImage &&
|
|
707
|
-
!vectorizedLogoMandatory &&
|
|
708
683
|
(colorPreviewEnabled || !colorPreviewRequirementFulfilled);
|
|
709
684
|
|
|
710
685
|
return (
|
|
@@ -804,7 +779,6 @@ const mapStateToProps = state => {
|
|
|
804
779
|
const colorPalettes = getColorPalettes(state);
|
|
805
780
|
const designProductionMethod = getSelectedDesignProductionMethod(state);
|
|
806
781
|
const vectorsRequired = !!get(designProductionMethod, 'options.vectorsRequired');
|
|
807
|
-
const vectorizedLogoMandatory = !!get(designProductionMethod, 'options.vectorizedLogoMandatory');
|
|
808
782
|
const colorDisabled = isColoringDisabled(state);
|
|
809
783
|
const userImages = getUserImages(imageGallery);
|
|
810
784
|
const hasPlaceHolderImage = hasPlaceHolderImagesForActiveDesignArea(state);
|
|
@@ -844,7 +818,6 @@ const mapStateToProps = state => {
|
|
|
844
818
|
userImages,
|
|
845
819
|
colorPalettes,
|
|
846
820
|
vectorsRequired,
|
|
847
|
-
vectorizedLogoMandatory,
|
|
848
821
|
colorDisabled,
|
|
849
822
|
uploadSize,
|
|
850
823
|
galleryHasImages,
|
|
@@ -13,7 +13,6 @@ import intersectionBy from 'lodash/intersectionBy';
|
|
|
13
13
|
import isEqual from 'lodash/isEqual';
|
|
14
14
|
import values from 'lodash/values';
|
|
15
15
|
import createSelector from 'Utils/Function/createSelector';
|
|
16
|
-
import memoize from 'Utils/Function/memoize';
|
|
17
16
|
import { getConf } from '../../configuration';
|
|
18
17
|
import { getMissingColorPalettesColors } from '../../Services/DesignDataService';
|
|
19
18
|
import { getConfigurator, getSelectedVariantIdentifier } from '../Configurator/Selectors';
|
|
@@ -369,19 +368,17 @@ export function getCurrentCanvasSize(state, defaultSize = zeroSize) {
|
|
|
369
368
|
return getCanvasSizeFromDesignProductionMethod(designProductionMethod);
|
|
370
369
|
}
|
|
371
370
|
|
|
372
|
-
const memoizedCanvasSize = memoize((width, height, isMetric, dpi) => ({
|
|
373
|
-
width,
|
|
374
|
-
height,
|
|
375
|
-
isMetric,
|
|
376
|
-
dpi,
|
|
377
|
-
}));
|
|
378
|
-
|
|
379
371
|
export function getCanvasSizeFromDesignProductionMethod(designProductionMethod, defaultSize = zeroSize) {
|
|
380
372
|
const { width, height, dpi } = designProductionMethod;
|
|
381
373
|
if (!width || !height) {
|
|
382
374
|
return defaultSize;
|
|
383
375
|
}
|
|
384
|
-
return
|
|
376
|
+
return {
|
|
377
|
+
width,
|
|
378
|
+
height,
|
|
379
|
+
isMetric: true,
|
|
380
|
+
dpi: dpi || getConf('designer.dpi', 300),
|
|
381
|
+
};
|
|
385
382
|
}
|
|
386
383
|
|
|
387
384
|
export function getCanvasSizeFromDesignArea(state, designArea, defaultSize = zeroSize) {
|
|
@@ -803,8 +800,7 @@ export const getDesignAreaImageCompatibilityInfo = designProductionMethod => {
|
|
|
803
800
|
.sort();
|
|
804
801
|
const vectorsRequired = !!get(designProductionMethod, 'options.vectorsRequired');
|
|
805
802
|
const maxColorAmount = get(designProductionMethod, 'options.maxColorAmount', 0);
|
|
806
|
-
|
|
807
|
-
return { colorPalettes, vectorsRequired, maxColorAmount, vectorizedLogoMandatory };
|
|
803
|
+
return { colorPalettes, vectorsRequired, maxColorAmount };
|
|
808
804
|
};
|
|
809
805
|
|
|
810
806
|
export const getCurrentCompatibilityInfoHash = state =>
|
|
@@ -816,7 +812,6 @@ export const areHashesCompatible = (storedHash, targetHash) => {
|
|
|
816
812
|
(storedHash &&
|
|
817
813
|
isEqual(storedHash.colorPalettes, targetHash.colorPalettes) &&
|
|
818
814
|
(!targetHash.vectorsRequired || storedHash.vectorsRequired) &&
|
|
819
|
-
(!targetHash.vectorizedLogoMandatory || storedHash.vectorizedLogoMandatory) &&
|
|
820
815
|
(!targetHash.maxColorAmount || storedHash.maxColorAmount <= targetHash.maxColorAmount))
|
|
821
816
|
);
|
|
822
817
|
};
|
|
@@ -900,21 +895,14 @@ export const getDesignAreaColorAmount = (maxColorAmount, preSelectionColorAmount
|
|
|
900
895
|
return amount;
|
|
901
896
|
};
|
|
902
897
|
|
|
903
|
-
export const isVectorizedLogoMandatory = designProductionMethod =>
|
|
904
|
-
!!designProductionMethod?.options?.vectorizedLogoMandatory;
|
|
905
|
-
|
|
906
898
|
export const getVectorizeForDesignProductionMethods = (state, designProductionMethodIdentifier) => {
|
|
907
899
|
const { designProductionMethod } = getSelectedDesignAreaProperties(state);
|
|
908
900
|
const newProductionMethod = getDesignProductionMethodByIdentifier(
|
|
909
901
|
state,
|
|
910
902
|
designProductionMethodIdentifier
|
|
911
903
|
);
|
|
912
|
-
const currentVectorsRequired =
|
|
913
|
-
|
|
914
|
-
isVectorizedLogoMandatory(designProductionMethod);
|
|
915
|
-
const newVectorsRequired =
|
|
916
|
-
!!get(newProductionMethod, 'options.vectorsRequired') &&
|
|
917
|
-
isVectorizedLogoMandatory(newProductionMethod);
|
|
904
|
+
const currentVectorsRequired = !!get(designProductionMethod, 'options.vectorsRequired');
|
|
905
|
+
const newVectorsRequired = !!get(newProductionMethod, 'options.vectorsRequired');
|
|
918
906
|
|
|
919
907
|
return {
|
|
920
908
|
currentVectorsRequired,
|
|
@@ -922,24 +910,6 @@ export const getVectorizeForDesignProductionMethods = (state, designProductionMe
|
|
|
922
910
|
};
|
|
923
911
|
};
|
|
924
912
|
|
|
925
|
-
export const getMandatoryVectorizationForDesignProductionMethods = (
|
|
926
|
-
state,
|
|
927
|
-
designProductionMethodIdentifier
|
|
928
|
-
) => {
|
|
929
|
-
const { designProductionMethod } = getSelectedDesignAreaProperties(state);
|
|
930
|
-
const newProductionMethod = getDesignProductionMethodByIdentifier(
|
|
931
|
-
state,
|
|
932
|
-
designProductionMethodIdentifier
|
|
933
|
-
);
|
|
934
|
-
const currentVectorsMandatory = isVectorizedLogoMandatory(designProductionMethod);
|
|
935
|
-
const newVectorsMandatory = isVectorizedLogoMandatory(newProductionMethod);
|
|
936
|
-
|
|
937
|
-
return {
|
|
938
|
-
currentVectorsMandatory,
|
|
939
|
-
newVectorsMandatory,
|
|
940
|
-
};
|
|
941
|
-
};
|
|
942
|
-
|
|
943
913
|
export const getImagesByDesignArea = (state, designAreaIdentifier) => {
|
|
944
914
|
if (!designAreaIdentifier) {
|
|
945
915
|
designAreaIdentifier = getSelectedDesignArea(state).identifier;
|
|
@@ -1588,7 +1588,6 @@ describe('Reducers/DesignArea/Selectors', () => {
|
|
|
1588
1588
|
expect(compatibilityInfo).toEqual({
|
|
1589
1589
|
colorPalettes: ['default'],
|
|
1590
1590
|
vectorsRequired: true,
|
|
1591
|
-
vectorizedLogoMandatory: false,
|
|
1592
1591
|
maxColorAmount: 4,
|
|
1593
1592
|
});
|
|
1594
1593
|
});
|
|
@@ -1603,7 +1602,6 @@ describe('Reducers/DesignArea/Selectors', () => {
|
|
|
1603
1602
|
options: {
|
|
1604
1603
|
maxColorAmount: 4,
|
|
1605
1604
|
vectorsRequired: true,
|
|
1606
|
-
vectorizedLogoMandatory: true,
|
|
1607
1605
|
},
|
|
1608
1606
|
colorPalettes: [
|
|
1609
1607
|
{
|
|
@@ -1633,7 +1631,6 @@ describe('Reducers/DesignArea/Selectors', () => {
|
|
|
1633
1631
|
expect(compatibilityInfo).toEqual({
|
|
1634
1632
|
colorPalettes: ['default'],
|
|
1635
1633
|
vectorsRequired: true,
|
|
1636
|
-
vectorizedLogoMandatory: true,
|
|
1637
1634
|
maxColorAmount: 4,
|
|
1638
1635
|
});
|
|
1639
1636
|
});
|
|
@@ -1667,22 +1664,6 @@ describe('Reducers/DesignArea/Selectors', () => {
|
|
|
1667
1664
|
}
|
|
1668
1665
|
)
|
|
1669
1666
|
).toBe(false);
|
|
1670
|
-
expect(
|
|
1671
|
-
areHashesCompatible(
|
|
1672
|
-
{
|
|
1673
|
-
colorPalettes: ['palette_1'],
|
|
1674
|
-
vectorsRequired: true,
|
|
1675
|
-
maxColorAmount: 4,
|
|
1676
|
-
vectorizedLogoMandatory: false,
|
|
1677
|
-
},
|
|
1678
|
-
{
|
|
1679
|
-
colorPalettes: ['palette_1'],
|
|
1680
|
-
vectorsRequired: true,
|
|
1681
|
-
maxColorAmount: 4,
|
|
1682
|
-
vectorizedLogoMandatory: true,
|
|
1683
|
-
}
|
|
1684
|
-
)
|
|
1685
|
-
).toBe(false);
|
|
1686
1667
|
});
|
|
1687
1668
|
|
|
1688
1669
|
test('areHashesCompatible returns the correct result compatible hashes', () => {
|
|
@@ -46,14 +46,11 @@ export const getEditDataFromOperations = (imageFileName, operations, designProdu
|
|
|
46
46
|
} = operations;
|
|
47
47
|
|
|
48
48
|
const maxColorAmount = +get(designProductionMethod, 'options.maxColorAmount', 0);
|
|
49
|
-
|
|
50
|
-
const vectorizedLogoMandatory = get(designProductionMethod, 'options.vectorizedLogoMandatory', false);
|
|
51
49
|
const vectorizeMonochrome = maxColorAmount === 1 && vectorizeThreshold === 1;
|
|
52
50
|
|
|
53
51
|
const result = {
|
|
54
52
|
fileName: imageFileName,
|
|
55
53
|
operations: [],
|
|
56
|
-
vectorizedLogoMandatory,
|
|
57
54
|
};
|
|
58
55
|
|
|
59
56
|
if (clipping && clippingColor) {
|
|
@@ -3,11 +3,7 @@ import { createAsyncTask } from '../UI/Actions';
|
|
|
3
3
|
import { getUserImagesByDesignArea } from './Selectors';
|
|
4
4
|
import { calculateImageBrightness } from '../../Services/DesignDataService';
|
|
5
5
|
import { getImageUsageInfo } from './Selectors';
|
|
6
|
-
import {
|
|
7
|
-
getCurrentCompatibilityInfoHash,
|
|
8
|
-
getSelectedDesignProductionMethod,
|
|
9
|
-
isVectorizedLogoMandatory,
|
|
10
|
-
} from '../DesignArea/Selectors';
|
|
6
|
+
import { getCurrentCompatibilityInfoHash } from '../DesignArea/Selectors';
|
|
11
7
|
|
|
12
8
|
export const RECEIVE_GALLERY = 'imageGallery/RECEIVE_GALLERY';
|
|
13
9
|
export const RECEIVE_GALLERY_TAGS = 'imageGallery/RECEIVE_GALLERY_TAGS';
|
|
@@ -98,9 +94,7 @@ export const updateImage = (identifier, imageDataPatch, immediateCommit = false)
|
|
|
98
94
|
};
|
|
99
95
|
|
|
100
96
|
export const uploadImage = file =>
|
|
101
|
-
createAsyncTask(WN_UPLOAD_IMAGE, async
|
|
102
|
-
const designProductionMethod = getSelectedDesignProductionMethod(getState());
|
|
103
|
-
const vectorizedLogoMandatory = isVectorizedLogoMandatory(designProductionMethod);
|
|
97
|
+
createAsyncTask(WN_UPLOAD_IMAGE, async dispatch => {
|
|
104
98
|
const data = new FormData();
|
|
105
99
|
data.append('userImage', file);
|
|
106
100
|
data.append('userImageEditData', JSON.stringify({}));
|
|
@@ -109,9 +103,7 @@ export const uploadImage = file =>
|
|
|
109
103
|
postDataAsync(
|
|
110
104
|
URL_UPLOAD,
|
|
111
105
|
data,
|
|
112
|
-
createDefaultReceiver(RECEIVE_IMAGE_UPLOAD_DATA,
|
|
113
|
-
vectorizedLogoMandatory,
|
|
114
|
-
}),
|
|
106
|
+
createDefaultReceiver(RECEIVE_IMAGE_UPLOAD_DATA),
|
|
115
107
|
{},
|
|
116
108
|
{},
|
|
117
109
|
{
|
|
@@ -150,9 +142,7 @@ export const dismissError = () => (dispatch, getState) => {
|
|
|
150
142
|
* @param actionOptions
|
|
151
143
|
*/
|
|
152
144
|
export const editImage = (editData, imageData, actionOptions = {}) =>
|
|
153
|
-
createAsyncTask(WN_UPLOAD_IMAGE, async
|
|
154
|
-
const designProductionMethod = getSelectedDesignProductionMethod(getState());
|
|
155
|
-
const vectorizedLogoMandatory = isVectorizedLogoMandatory(designProductionMethod);
|
|
145
|
+
createAsyncTask(WN_UPLOAD_IMAGE, async dispatch => {
|
|
156
146
|
const data = new FormData();
|
|
157
147
|
const { createCopy } = editData;
|
|
158
148
|
data.append('userImageEditData', JSON.stringify(editData));
|
|
@@ -161,12 +151,7 @@ export const editImage = (editData, imageData, actionOptions = {}) =>
|
|
|
161
151
|
postDataAsync(
|
|
162
152
|
URL_UPLOAD,
|
|
163
153
|
data,
|
|
164
|
-
createDefaultReceiver(RECEIVE_IMAGE_UPLOAD_DATA, {
|
|
165
|
-
imageData,
|
|
166
|
-
createCopy,
|
|
167
|
-
vectorizedLogoMandatory,
|
|
168
|
-
...actionOptions,
|
|
169
|
-
})
|
|
154
|
+
createDefaultReceiver(RECEIVE_IMAGE_UPLOAD_DATA, { imageData, createCopy, ...actionOptions })
|
|
170
155
|
)
|
|
171
156
|
);
|
|
172
157
|
return await calculateImageBrightness(uploadResponse);
|
|
@@ -30,11 +30,6 @@ const updateDerivedImageDataProps = imageData => {
|
|
|
30
30
|
imageData.displayColorPreview = getConf('autoPreviewVectorization', true);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (imageData.vectorizedLogoMandatory) {
|
|
34
|
-
imageData.colorPreviewEnabled = false;
|
|
35
|
-
imageData.displayColorPreview = true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
33
|
return imageData;
|
|
39
34
|
};
|
|
40
35
|
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
getCurrentCompatibilityInfoHash,
|
|
13
13
|
getDesignProductionMethodByIdentifier,
|
|
14
14
|
getSelectedDesignProductionMethod,
|
|
15
|
-
isVectorizedLogoMandatory,
|
|
16
15
|
} from '../DesignArea/Selectors';
|
|
17
16
|
import isEqual from 'lodash/isEqual';
|
|
18
17
|
|
|
@@ -142,9 +141,9 @@ export const isColorPreviewCompatible = (state, image, designProductionMethodIde
|
|
|
142
141
|
const designProductionMethod = designProductionMethodIdentifier
|
|
143
142
|
? getDesignProductionMethodByIdentifier(state, designProductionMethodIdentifier)
|
|
144
143
|
: getSelectedDesignProductionMethod(state);
|
|
145
|
-
const colorPreviewRequired =
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
const colorPreviewRequired = designProductionMethodHasEmbroideryVisualizationEffect(
|
|
145
|
+
designProductionMethod
|
|
146
|
+
);
|
|
148
147
|
|
|
149
148
|
const displayColorPreview = image && (!!image.gallery || !!image.displayColorPreview);
|
|
150
149
|
// do not let the user to add a raster image if the production method is embroidery
|
|
@@ -35,10 +35,6 @@ jest.mock('../../../Services/DesignDataService');
|
|
|
35
35
|
|
|
36
36
|
/*skipped Tests should be updated , the tests run properly in test file but fail globally in 'npm run test'*/
|
|
37
37
|
describe('Reducers/ImageGallery/Actions', () => {
|
|
38
|
-
afterEach(() => {
|
|
39
|
-
jest.clearAllMocks();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
38
|
it('getGalleryUrlForTags encodes tags as comma separated query params', () => {
|
|
43
39
|
const tags = [
|
|
44
40
|
{ title: 'tag1', checked: true },
|
|
@@ -55,7 +51,7 @@ describe('Reducers/ImageGallery/Actions', () => {
|
|
|
55
51
|
expect(fetchDataAsync.mock.calls[0][0]).toBe(URL_TAGS);
|
|
56
52
|
expect(fetchDataAsync.mock.calls[0][1]).toBe(receiveGalleryTags);
|
|
57
53
|
});
|
|
58
|
-
it('selectTags calls dispatch with the correct action and calls dispatch with the fetchGalleryAction too', () => {
|
|
54
|
+
it.skip('selectTags calls dispatch with the correct action and calls dispatch with the fetchGalleryAction too', () => {
|
|
59
55
|
const tags = [{ title: 'Cars', checked: true }];
|
|
60
56
|
const dispatch = jest.fn();
|
|
61
57
|
selectTags(tags)(dispatch);
|
|
@@ -65,7 +61,7 @@ describe('Reducers/ImageGallery/Actions', () => {
|
|
|
65
61
|
});
|
|
66
62
|
expect(fetchDataAsync.mock.calls[0][0]).toBe(getGalleryUrlForTags(tags));
|
|
67
63
|
});
|
|
68
|
-
it('fetchGallery calls fetchDataAsync with the correct url and receive action creator', () => {
|
|
64
|
+
it.skip('fetchGallery calls fetchDataAsync with the correct url and receive action creator', () => {
|
|
69
65
|
const mockResult = jest.fn(() => ({}));
|
|
70
66
|
const fetchDataAsyncSpy = jest.fn(() => mockResult);
|
|
71
67
|
fetchDataAsync.mockImplementationOnce(fetchDataAsyncSpy);
|
|
@@ -84,46 +80,12 @@ describe('Reducers/ImageGallery/Actions', () => {
|
|
|
84
80
|
fileName,
|
|
85
81
|
});
|
|
86
82
|
const dispatch = jest.fn();
|
|
87
|
-
|
|
88
|
-
configurator: {
|
|
89
|
-
configuration: {
|
|
90
|
-
designdata: {
|
|
91
|
-
designArea1: {
|
|
92
|
-
designProductionMethodIdentifier: 'customPrinting',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
designArea: {
|
|
98
|
-
selectedDesignArea: {
|
|
99
|
-
identifier: 'designArea1',
|
|
100
|
-
mask: null,
|
|
101
|
-
designProductionMethods: [
|
|
102
|
-
{
|
|
103
|
-
identifier: 'customPrinting',
|
|
104
|
-
mask: null,
|
|
105
|
-
options: {
|
|
106
|
-
maxColorAmount: 4,
|
|
107
|
-
vectorsRequired: true,
|
|
108
|
-
vectorizedLogoMandatory: true,
|
|
109
|
-
},
|
|
110
|
-
colorPalettes: [
|
|
111
|
-
{
|
|
112
|
-
identifier: 'default',
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
await uploadImage(fileName)(dispatch, getState);
|
|
83
|
+
await uploadImage(fileName)(dispatch);
|
|
121
84
|
expect(postDataAsync.mock.calls[0][0]).toEqual(URL_UPLOAD);
|
|
122
85
|
expect(formDataToJSON(postDataAsync.mock.calls[0][1]).userImage).toEqual(fileName);
|
|
123
|
-
expect(createDefaultReceiver
|
|
124
|
-
expect(createDefaultReceiver.mock.calls[0][1]).toMatchObject({ vectorizedLogoMandatory: true });
|
|
86
|
+
expect(createDefaultReceiver).toBeCalledWith(RECEIVE_IMAGE_UPLOAD_DATA);
|
|
125
87
|
});
|
|
126
|
-
it('editImage calls postDataAsync with the correct params', async () => {
|
|
88
|
+
it.skip('editImage calls postDataAsync with the correct params', async () => {
|
|
127
89
|
const fileName = 'test.png';
|
|
128
90
|
createAsyncTask.mockImplementationOnce((name, action) => action);
|
|
129
91
|
postDataAsync.mockResolvedValueOnce({
|
|
@@ -139,46 +101,12 @@ describe('Reducers/ImageGallery/Actions', () => {
|
|
|
139
101
|
},
|
|
140
102
|
],
|
|
141
103
|
};
|
|
142
|
-
|
|
143
|
-
configurator: {
|
|
144
|
-
configuration: {
|
|
145
|
-
designdata: {
|
|
146
|
-
designArea1: {
|
|
147
|
-
designProductionMethodIdentifier: 'customPrinting',
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
designArea: {
|
|
153
|
-
selectedDesignArea: {
|
|
154
|
-
identifier: 'designArea1',
|
|
155
|
-
mask: null,
|
|
156
|
-
designProductionMethods: [
|
|
157
|
-
{
|
|
158
|
-
identifier: 'customPrinting',
|
|
159
|
-
mask: null,
|
|
160
|
-
options: {
|
|
161
|
-
maxColorAmount: 4,
|
|
162
|
-
vectorsRequired: true,
|
|
163
|
-
vectorizedLogoMandatory: true,
|
|
164
|
-
},
|
|
165
|
-
colorPalettes: [
|
|
166
|
-
{
|
|
167
|
-
identifier: 'default',
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
await editImage(editData)(dispatch, getState);
|
|
104
|
+
await editImage(editData)(dispatch);
|
|
176
105
|
expect(postDataAsync.mock.calls[0][0]).toEqual(URL_UPLOAD);
|
|
177
106
|
expect(formDataToJSON(postDataAsync.mock.calls[0][1]).userImageEditData).toEqual(
|
|
178
107
|
JSON.stringify(editData)
|
|
179
108
|
);
|
|
180
|
-
expect(createDefaultReceiver
|
|
181
|
-
expect(createDefaultReceiver.mock.calls[0][1]).toMatchObject({ vectorizedLogoMandatory: true });
|
|
109
|
+
expect(createDefaultReceiver).toBeCalledWith(RECEIVE_IMAGE_UPLOAD_DATA);
|
|
182
110
|
});
|
|
183
111
|
it('dismissError creates the correct action', () => {
|
|
184
112
|
const dispatch = jest.fn();
|
|
@@ -267,7 +195,6 @@ describe('Reducers/ImageGallery/Actions', () => {
|
|
|
267
195
|
options: {
|
|
268
196
|
maxColorAmount: 4,
|
|
269
197
|
vectorsRequired: true,
|
|
270
|
-
vectorizedLogoMandatory: true,
|
|
271
198
|
},
|
|
272
199
|
colorPalettes: [
|
|
273
200
|
{
|
|
@@ -295,7 +222,6 @@ describe('Reducers/ImageGallery/Actions', () => {
|
|
|
295
222
|
vectorizeColorsMap,
|
|
296
223
|
compatibilityInfoHash: {
|
|
297
224
|
maxColorAmount: 4,
|
|
298
|
-
vectorizedLogoMandatory: true,
|
|
299
225
|
vectorsRequired: true,
|
|
300
226
|
colorPalettes: ['default'],
|
|
301
227
|
},
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
getCameraViewListForDesignAreaList,
|
|
8
8
|
getDefaultDesignAreaIdentifierFromProductionMethod,
|
|
9
9
|
getSelectedDesignProductionMethodForDesignArea,
|
|
10
|
-
isVectorizedLogoMandatory,
|
|
11
10
|
} from '../../Reducers/DesignArea/Selectors';
|
|
12
11
|
import { getSelectedVariantIdentifier } from '../../Reducers/Configurator/Selectors';
|
|
13
12
|
import { setSelectedImageData } from '../../Reducers/ImageGallery/Actions';
|
|
@@ -51,8 +50,6 @@ const prepareImageData = (function createImageDataPreProcessor() {
|
|
|
51
50
|
const colorPreviewRequired = designProductionMethodHasEmbroideryVisualizationEffect(
|
|
52
51
|
designProductionMethod
|
|
53
52
|
);
|
|
54
|
-
const vectorizedLogoMandatory = isVectorizedLogoMandatory(designProductionMethod);
|
|
55
|
-
|
|
56
53
|
if (colorPreviewRequired) {
|
|
57
54
|
// creating the color map, as it was added from the image edit dialog
|
|
58
55
|
const svgContent = await getSvgContent(imageData.preview.url, false, true);
|
|
@@ -62,7 +59,7 @@ const prepareImageData = (function createImageDataPreProcessor() {
|
|
|
62
59
|
...imageData,
|
|
63
60
|
colorPreviewRequired: true,
|
|
64
61
|
displayColorPreview: true,
|
|
65
|
-
colorPreviewEnabled:
|
|
62
|
+
colorPreviewEnabled: true,
|
|
66
63
|
operations: {
|
|
67
64
|
...imageData.operations,
|
|
68
65
|
vectorizeColorsMap,
|