thm-p3-configurator 0.0.148 → 0.0.150
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.
|
@@ -28,17 +28,17 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
28
28
|
var _reactRouter = require("react-router");
|
|
29
29
|
var _logoPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-primary.png"));
|
|
30
30
|
var _queries = require("../__api__/queries");
|
|
31
|
+
var _CheckboxInput = _interopRequireDefault(require("../__components__/Form/CheckboxInput"));
|
|
31
32
|
var _ProductCard = _interopRequireDefault(require("../__components__/ProductCard"));
|
|
32
33
|
var _FullPageSpinner = _interopRequireDefault(require("../__components__/Spinners/FullPageSpinner"));
|
|
33
34
|
var _constants__ = require("../__constants__");
|
|
34
35
|
var _FormulaContext = require("../__context__/FormulaContext");
|
|
35
|
-
var _useIsTmg = require("../__hooks__/useIsTmg");
|
|
36
36
|
var _OrderSessionContext = require("../__context__/OrderSessionContext");
|
|
37
37
|
var _helpers__ = require("../__helpers__");
|
|
38
38
|
var _image = require("../__helpers__/image");
|
|
39
39
|
var _product = require("../__helpers__/product");
|
|
40
|
+
var _useIsTmg = require("../__hooks__/useIsTmg");
|
|
40
41
|
var _BoardComputerCard = _interopRequireDefault(require("./BoardComputerCard"));
|
|
41
|
-
var _CheckboxInput = _interopRequireDefault(require("../__components__/Form/CheckboxInput"));
|
|
42
42
|
function _interopRequireDefault(e) {
|
|
43
43
|
return e && e.__esModule ? e : {
|
|
44
44
|
default: e
|
|
@@ -141,6 +141,15 @@ const ProductsOverview = () => {
|
|
|
141
141
|
switch (productCategory) {
|
|
142
142
|
case _constants__.PRODUCT_CATEGORIES.TOWBAR:
|
|
143
143
|
{
|
|
144
|
+
// When selecting a towbar, deselect any combiset
|
|
145
|
+
if (isSelected && selectedCombiset) {
|
|
146
|
+
dispatch({
|
|
147
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_COMBISET,
|
|
148
|
+
payload: {
|
|
149
|
+
combisetId: null
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
144
153
|
dispatch({
|
|
145
154
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_TOWBAR,
|
|
146
155
|
payload: {
|
|
@@ -151,6 +160,15 @@ const ProductsOverview = () => {
|
|
|
151
160
|
}
|
|
152
161
|
case _constants__.PRODUCT_CATEGORIES.CABLESET:
|
|
153
162
|
{
|
|
163
|
+
// When selecting a cableset, deselect any combiset
|
|
164
|
+
if (isSelected && selectedCombiset) {
|
|
165
|
+
dispatch({
|
|
166
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_COMBISET,
|
|
167
|
+
payload: {
|
|
168
|
+
combisetId: null
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
154
172
|
dispatch({
|
|
155
173
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
|
|
156
174
|
payload: {
|
|
@@ -161,6 +179,25 @@ const ProductsOverview = () => {
|
|
|
161
179
|
}
|
|
162
180
|
case _constants__.PRODUCT_CATEGORIES.COMBISET:
|
|
163
181
|
{
|
|
182
|
+
// When selecting a combiset, deselect any towbar and cableset
|
|
183
|
+
if (isSelected) {
|
|
184
|
+
if (selectedTowbar) {
|
|
185
|
+
dispatch({
|
|
186
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_TOWBAR,
|
|
187
|
+
payload: {
|
|
188
|
+
towbarId: null
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
if (selectedCableset) {
|
|
193
|
+
dispatch({
|
|
194
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
|
|
195
|
+
payload: {
|
|
196
|
+
cabelsetId: null
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
164
201
|
dispatch({
|
|
165
202
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_COMBISET,
|
|
166
203
|
payload: {
|
|
@@ -188,6 +225,7 @@ const ProductsOverview = () => {
|
|
|
188
225
|
|
|
189
226
|
// Filter out Extras category from products object
|
|
190
227
|
delete products[_constants__.PRODUCT_CATEGORIES.EXTRAS];
|
|
228
|
+
console.log(selectedBoardComputer, selectedCableset, selectedCombiset, selectedTowbar);
|
|
191
229
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isTmg && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
192
230
|
name: 'skipFilters',
|
|
193
231
|
initialValue: skipFilters,
|
|
@@ -213,11 +251,11 @@ const ProductsOverview = () => {
|
|
|
213
251
|
category: productCategory
|
|
214
252
|
});
|
|
215
253
|
|
|
216
|
-
// Check if another product within the same category has already been selected
|
|
254
|
+
// Check if another product within the same category has already been selected
|
|
217
255
|
const isAnotherProductSelected = productsPerCategory.some(otherProduct => [selectedCableset, selectedCombiset, selectedTowbar].includes(otherProduct.articleNumber) && otherProduct.articleNumber !== product.articleNumber);
|
|
218
256
|
if (productCategory === _constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER && selectedCableset) {
|
|
219
257
|
return /*#__PURE__*/_react.default.createElement(_BoardComputerCard.default, {
|
|
220
|
-
defaultSelected:
|
|
258
|
+
defaultSelected: selectedBoardComputer === product.articleNumber,
|
|
221
259
|
onSelect: _ref4 => {
|
|
222
260
|
let {
|
|
223
261
|
productId,
|
|
@@ -259,9 +297,12 @@ const ProductsOverview = () => {
|
|
|
259
297
|
imageId: product === null || product === void 0 || (_product$images2 = product.images) === null || _product$images2 === void 0 ? void 0 : _product$images2[0]
|
|
260
298
|
}) : _logoPrimary.default,
|
|
261
299
|
isDisabled: false,
|
|
262
|
-
defaultSelected:
|
|
263
|
-
|
|
264
|
-
|
|
300
|
+
defaultSelected: productCategory === _constants__.PRODUCT_CATEGORIES.TOWBAR && selectedTowbar === product.articleNumber || productCategory === _constants__.PRODUCT_CATEGORIES.CABLESET && selectedCableset === product.articleNumber || productCategory === _constants__.PRODUCT_CATEGORIES.COMBISET && selectedCombiset === product.articleNumber
|
|
301
|
+
// Set both to false to prevent auto-selection when navigating back
|
|
302
|
+
,
|
|
303
|
+
|
|
304
|
+
isAnotherProductSelected: true,
|
|
305
|
+
isOnlyProductInCategory: false,
|
|
265
306
|
onSelect: _ref5 => {
|
|
266
307
|
let {
|
|
267
308
|
productId,
|