@configuratorware/configurator-frontendgui 1.57.7 → 1.57.9

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.
@@ -243,9 +243,9 @@ var applyVariantAmountPreSelection = exports.applyVariantAmountPreSelection = fu
243
243
  var designerPreSelection = (0, _configuration.getConf)('designerPreSelection', {});
244
244
  var itemAmounts = designerPreSelection.itemAmounts;
245
245
  if (itemAmounts) {
246
- var children = (0, _Selectors.getChildren)(configurator).map(function (variant) {
247
- return variant.identifier;
248
- });
246
+ var children = (0, _flatten["default"])((0, _Selectors.getChildren)(configurator).map(function (variant) {
247
+ return Object.values((0, _Selectors.getDeepestChildIdentifiers)(variant));
248
+ }));
249
249
  for (var preSelectionVariant in itemAmounts) {
250
250
  if (!itemAmounts.hasOwnProperty(preSelectionVariant)) {
251
251
  continue;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-frontendgui",
3
- "version": "1.57.7",
3
+ "version": "1.57.9",
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.57.7",
9
+ "@configuratorware/scripts": "1.57.9",
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.57.7",
40
- "redhotmagma-visualization": "1.57.7",
39
+ "redhotmagma-graphics-editor": "1.57.9",
40
+ "redhotmagma-visualization": "1.57.9",
41
41
  "redux": "^4.1.0",
42
42
  "redux-logger": "^3.0.6",
43
43
  "redux-persist": "^5.10.0",
@@ -200,7 +200,9 @@ export const applyVariantAmountPreSelection = configurator => {
200
200
  const itemAmounts = designerPreSelection.itemAmounts;
201
201
 
202
202
  if (itemAmounts) {
203
- const children = getChildren(configurator).map(variant => variant.identifier);
203
+ const children = flatten(
204
+ getChildren(configurator).map(variant => Object.values(getDeepestChildIdentifiers(variant)))
205
+ );
204
206
 
205
207
  for (const preSelectionVariant in itemAmounts) {
206
208
  if (!itemAmounts.hasOwnProperty(preSelectionVariant)) {
@@ -84,6 +84,49 @@ describe('Reducers/Configurator/Actions', () => {
84
84
  expect(configuratorService.setSelectedAmount).toBeCalledWith('hoodie2', 5);
85
85
  });
86
86
 
87
+ test('applyVariantAmountPreSelection sets the amount for a non-representative size of a color', () => {
88
+ const mockConfigurator = {
89
+ configuration: {
90
+ item: {
91
+ itemGroup: {
92
+ children: [
93
+ {
94
+ identifier: 'hoodie_red_m',
95
+ itemGroup: {
96
+ children: [
97
+ { identifier: 'hoodie_red_s', itemgroupentryIdentifier: 's' },
98
+ { identifier: 'hoodie_red_m', itemgroupentryIdentifier: 'm' },
99
+ ],
100
+ },
101
+ },
102
+ {
103
+ identifier: 'hoodie_blue_m',
104
+ itemGroup: {
105
+ children: [
106
+ { identifier: 'hoodie_blue_m', itemgroupentryIdentifier: 'm' },
107
+ { identifier: 'hoodie_blue_l', itemgroupentryIdentifier: 'l' },
108
+ ],
109
+ },
110
+ },
111
+ ],
112
+ },
113
+ },
114
+ },
115
+ };
116
+
117
+ const mockPreSelection = {
118
+ itemAmounts: {
119
+ hoodie_red_s: 2,
120
+ },
121
+ };
122
+
123
+ setConf('designerPreSelection', mockPreSelection);
124
+
125
+ applyVariantAmountPreSelection(mockConfigurator);
126
+
127
+ expect(configuratorService.setSelectedAmount).toBeCalledWith('hoodie_red_s', 2);
128
+ });
129
+
87
130
  describe('receiveConfiguration', () => {
88
131
  const configurator = {
89
132
  configuration: {