thm-p3-configurator 0.0.157 → 0.0.159

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.
@@ -408,7 +408,7 @@ const useSingleOrderCart = () => {
408
408
  */
409
409
  exports.useSingleOrderCart = useSingleOrderCart;
410
410
  const useProductsQuery = orderParameters => {
411
- var _productsQuery$data, _productsQuery$data2, _productsQuery$data3, _productsQuery$data4, _productsQuery$data5, _productsQuery$data6, _productsQuery$data7, _productsQuery$data8, _productsQuery$data9, _productsQuery$data$a, _productsQuery$data10, _productsQuery$data$c, _productsQuery$data11, _productsQuery$data$a2, _productsQuery$data12, _productsQuery$data$a3, _productsQuery$data13, _productsQuery$data$a4, _productsQuery$data14, _productsQuery$data15, _productsQuery$data16, _productsQuery$data$a5, _productsQuery$data17, _productsQuery$data$t, _productsQuery$data18;
411
+ var _productsQuery$data, _productsQuery$data2, _productsQuery$data3, _productsQuery$data4, _productsQuery$data5, _productsQuery$data6, _productsQuery$data7, _productsQuery$data8, _productsQuery$data9, _productsQuery$data10, _productsQuery$data11, _productsQuery$data12, _productsQuery$data13, _productsQuery$data14, _productsQuery$data15, _productsQuery$data16, _productsQuery$data$a, _productsQuery$data17, _productsQuery$data$c, _productsQuery$data18, _productsQuery$data$a2, _productsQuery$data19, _productsQuery$data$a3, _productsQuery$data20, _productsQuery$data$a4, _productsQuery$data21, _productsQuery$data22, _productsQuery$data23, _productsQuery$data$a5, _productsQuery$data24, _productsQuery$data$t, _productsQuery$data25;
412
412
  const {
413
413
  licensePlate,
414
414
  model,
@@ -461,30 +461,38 @@ const useProductsQuery = orderParameters => {
461
461
  }
462
462
  }
463
463
  });
464
+ const buildYear = new Date(productsQuery === null || productsQuery === void 0 || (_productsQuery$data = productsQuery.data) === null || _productsQuery$data === void 0 || (_productsQuery$data = _productsQuery$data.vehicleInfo) === null || _productsQuery$data === void 0 || (_productsQuery$data = _productsQuery$data.vehicle) === null || _productsQuery$data === void 0 ? void 0 : _productsQuery$data.constructionDate).getFullYear();
464
465
  return {
465
466
  isLoadingProducts: productsQuery.isLoading,
466
467
  isProductsError: productsQuery.isError,
467
- vehicleLogo: productsQuery === null || productsQuery === void 0 || (_productsQuery$data = productsQuery.data) === null || _productsQuery$data === void 0 || (_productsQuery$data = _productsQuery$data.vehicleInfo) === null || _productsQuery$data === void 0 || (_productsQuery$data = _productsQuery$data.make) === null || _productsQuery$data === void 0 ? void 0 : _productsQuery$data.logo,
468
+ vehicleLogo: productsQuery === null || productsQuery === void 0 || (_productsQuery$data2 = productsQuery.data) === null || _productsQuery$data2 === void 0 || (_productsQuery$data2 = _productsQuery$data2.vehicleInfo) === null || _productsQuery$data2 === void 0 || (_productsQuery$data2 = _productsQuery$data2.make) === null || _productsQuery$data2 === void 0 ? void 0 : _productsQuery$data2.logo,
468
469
  vehicleDetails: {
469
- merk: productsQuery === null || productsQuery === void 0 || (_productsQuery$data2 = productsQuery.data) === null || _productsQuery$data2 === void 0 || (_productsQuery$data2 = _productsQuery$data2.vehicleInfo) === null || _productsQuery$data2 === void 0 || (_productsQuery$data2 = _productsQuery$data2.make) === null || _productsQuery$data2 === void 0 ? void 0 : _productsQuery$data2.name,
470
- model: productsQuery === null || productsQuery === void 0 || (_productsQuery$data3 = productsQuery.data) === null || _productsQuery$data3 === void 0 || (_productsQuery$data3 = _productsQuery$data3.vehicleInfo) === null || _productsQuery$data3 === void 0 || (_productsQuery$data3 = _productsQuery$data3.model) === null || _productsQuery$data3 === void 0 ? void 0 : _productsQuery$data3.name,
471
- duration: productsQuery === null || productsQuery === void 0 || (_productsQuery$data4 = productsQuery.data) === null || _productsQuery$data4 === void 0 || (_productsQuery$data4 = _productsQuery$data4.vehicleInfo) === null || _productsQuery$data4 === void 0 || (_productsQuery$data4 = _productsQuery$data4.model) === null || _productsQuery$data4 === void 0 ? void 0 : _productsQuery$data4.duration,
472
- carrosserie: productsQuery === null || productsQuery === void 0 || (_productsQuery$data5 = productsQuery.data) === null || _productsQuery$data5 === void 0 || (_productsQuery$data5 = _productsQuery$data5.vehicleInfo) === null || _productsQuery$data5 === void 0 || (_productsQuery$data5 = _productsQuery$data5.vehicle) === null || _productsQuery$data5 === void 0 || (_productsQuery$data5 = _productsQuery$data5.bodyType) === null || _productsQuery$data5 === void 0 ? void 0 : _productsQuery$data5.description,
473
- brandstof: productsQuery === null || productsQuery === void 0 || (_productsQuery$data6 = productsQuery.data) === null || _productsQuery$data6 === void 0 || (_productsQuery$data6 = _productsQuery$data6.vehicleInfo) === null || _productsQuery$data6 === void 0 || (_productsQuery$data6 = _productsQuery$data6.vehicle) === null || _productsQuery$data6 === void 0 || (_productsQuery$data6 = _productsQuery$data6.fuelType) === null || _productsQuery$data6 === void 0 ? void 0 : _productsQuery$data6.description,
474
- uitvoering: productsQuery === null || productsQuery === void 0 || (_productsQuery$data7 = productsQuery.data) === null || _productsQuery$data7 === void 0 || (_productsQuery$data7 = _productsQuery$data7.answers) === null || _productsQuery$data7 === void 0 ? void 0 : _productsQuery$data7.execution1,
475
- 'uitvoering #2': productsQuery === null || productsQuery === void 0 || (_productsQuery$data8 = productsQuery.data) === null || _productsQuery$data8 === void 0 || (_productsQuery$data8 = _productsQuery$data8.answers) === null || _productsQuery$data8 === void 0 ? void 0 : _productsQuery$data8.execution2
470
+ merk: productsQuery === null || productsQuery === void 0 || (_productsQuery$data3 = productsQuery.data) === null || _productsQuery$data3 === void 0 || (_productsQuery$data3 = _productsQuery$data3.vehicleInfo) === null || _productsQuery$data3 === void 0 || (_productsQuery$data3 = _productsQuery$data3.make) === null || _productsQuery$data3 === void 0 ? void 0 : _productsQuery$data3.name,
471
+ model: productsQuery === null || productsQuery === void 0 || (_productsQuery$data4 = productsQuery.data) === null || _productsQuery$data4 === void 0 || (_productsQuery$data4 = _productsQuery$data4.vehicleInfo) === null || _productsQuery$data4 === void 0 || (_productsQuery$data4 = _productsQuery$data4.model) === null || _productsQuery$data4 === void 0 ? void 0 : _productsQuery$data4.name,
472
+ duration: productsQuery === null || productsQuery === void 0 || (_productsQuery$data5 = productsQuery.data) === null || _productsQuery$data5 === void 0 || (_productsQuery$data5 = _productsQuery$data5.vehicleInfo) === null || _productsQuery$data5 === void 0 || (_productsQuery$data5 = _productsQuery$data5.model) === null || _productsQuery$data5 === void 0 ? void 0 : _productsQuery$data5.duration,
473
+ carrosserie: productsQuery === null || productsQuery === void 0 || (_productsQuery$data6 = productsQuery.data) === null || _productsQuery$data6 === void 0 || (_productsQuery$data6 = _productsQuery$data6.vehicleInfo) === null || _productsQuery$data6 === void 0 || (_productsQuery$data6 = _productsQuery$data6.vehicle) === null || _productsQuery$data6 === void 0 || (_productsQuery$data6 = _productsQuery$data6.bodyType) === null || _productsQuery$data6 === void 0 ? void 0 : _productsQuery$data6.description,
474
+ brandstof: productsQuery === null || productsQuery === void 0 || (_productsQuery$data7 = productsQuery.data) === null || _productsQuery$data7 === void 0 || (_productsQuery$data7 = _productsQuery$data7.vehicleInfo) === null || _productsQuery$data7 === void 0 || (_productsQuery$data7 = _productsQuery$data7.vehicle) === null || _productsQuery$data7 === void 0 || (_productsQuery$data7 = _productsQuery$data7.fuelType) === null || _productsQuery$data7 === void 0 ? void 0 : _productsQuery$data7.description,
475
+ uitvoering: productsQuery === null || productsQuery === void 0 || (_productsQuery$data8 = productsQuery.data) === null || _productsQuery$data8 === void 0 || (_productsQuery$data8 = _productsQuery$data8.answers) === null || _productsQuery$data8 === void 0 ? void 0 : _productsQuery$data8.execution1,
476
+ 'uitvoering #2': productsQuery === null || productsQuery === void 0 || (_productsQuery$data9 = productsQuery.data) === null || _productsQuery$data9 === void 0 || (_productsQuery$data9 = _productsQuery$data9.answers) === null || _productsQuery$data9 === void 0 ? void 0 : _productsQuery$data9.execution2,
477
+ Geimporteerd: productsQuery !== null && productsQuery !== void 0 && (_productsQuery$data10 = productsQuery.data) !== null && _productsQuery$data10 !== void 0 && (_productsQuery$data10 = _productsQuery$data10.vehicleInfo) !== null && _productsQuery$data10 !== void 0 && (_productsQuery$data10 = _productsQuery$data10.vehicle) !== null && _productsQuery$data10 !== void 0 && _productsQuery$data10.isImported ? 'Ja' : 'Nee',
478
+ 'Trekgewicht op kenteken': Boolean(productsQuery === null || productsQuery === void 0 || (_productsQuery$data11 = productsQuery.data) === null || _productsQuery$data11 === void 0 || (_productsQuery$data11 = _productsQuery$data11.vehicleInfo) === null || _productsQuery$data11 === void 0 || (_productsQuery$data11 = _productsQuery$data11.vehicle) === null || _productsQuery$data11 === void 0 ? void 0 : _productsQuery$data11.maxTowingMassBraked) ? 'Ja' : 'Nee',
479
+ 'Max. Trekgewicht, geremd': productsQuery === null || productsQuery === void 0 || (_productsQuery$data12 = productsQuery.data) === null || _productsQuery$data12 === void 0 || (_productsQuery$data12 = _productsQuery$data12.vehicleInfo) === null || _productsQuery$data12 === void 0 || (_productsQuery$data12 = _productsQuery$data12.vehicle) === null || _productsQuery$data12 === void 0 ? void 0 : _productsQuery$data12.maxTowingMassBraked,
480
+ 'Max. Trekgewicht, niet geremd': productsQuery === null || productsQuery === void 0 || (_productsQuery$data13 = productsQuery.data) === null || _productsQuery$data13 === void 0 || (_productsQuery$data13 = _productsQuery$data13.vehicleInfo) === null || _productsQuery$data13 === void 0 || (_productsQuery$data13 = _productsQuery$data13.vehicle) === null || _productsQuery$data13 === void 0 ? void 0 : _productsQuery$data13.maxTowingMassUnbraked,
481
+ bouwjaar: buildYear,
482
+ kType: productsQuery === null || productsQuery === void 0 || (_productsQuery$data14 = productsQuery.data) === null || _productsQuery$data14 === void 0 || (_productsQuery$data14 = _productsQuery$data14.vehicleInfo) === null || _productsQuery$data14 === void 0 || (_productsQuery$data14 = _productsQuery$data14.model) === null || _productsQuery$data14 === void 0 ? void 0 : _productsQuery$data14.kType,
483
+ kMod: productsQuery === null || productsQuery === void 0 || (_productsQuery$data15 = productsQuery.data) === null || _productsQuery$data15 === void 0 || (_productsQuery$data15 = _productsQuery$data15.vehicleInfo) === null || _productsQuery$data15 === void 0 || (_productsQuery$data15 = _productsQuery$data15.model) === null || _productsQuery$data15 === void 0 ? void 0 : _productsQuery$data15.kMod
476
484
  },
477
- discountCodeInfo: productsQuery === null || productsQuery === void 0 || (_productsQuery$data9 = productsQuery.data) === null || _productsQuery$data9 === void 0 ? void 0 : _productsQuery$data9.discountCodeInfo,
478
- discountProducts: (_productsQuery$data$a = productsQuery === null || productsQuery === void 0 || (_productsQuery$data10 = productsQuery.data) === null || _productsQuery$data10 === void 0 || (_productsQuery$data10 = _productsQuery$data10.articles) === null || _productsQuery$data10 === void 0 ? void 0 : _productsQuery$data10.discountCode) !== null && _productsQuery$data$a !== void 0 ? _productsQuery$data$a : [],
479
- cart: (_productsQuery$data$c = productsQuery === null || productsQuery === void 0 || (_productsQuery$data11 = productsQuery.data) === null || _productsQuery$data11 === void 0 ? void 0 : _productsQuery$data11.cart) !== null && _productsQuery$data$c !== void 0 ? _productsQuery$data$c : [],
485
+ discountCodeInfo: productsQuery === null || productsQuery === void 0 || (_productsQuery$data16 = productsQuery.data) === null || _productsQuery$data16 === void 0 ? void 0 : _productsQuery$data16.discountCodeInfo,
486
+ discountProducts: (_productsQuery$data$a = productsQuery === null || productsQuery === void 0 || (_productsQuery$data17 = productsQuery.data) === null || _productsQuery$data17 === void 0 || (_productsQuery$data17 = _productsQuery$data17.articles) === null || _productsQuery$data17 === void 0 ? void 0 : _productsQuery$data17.discountCode) !== null && _productsQuery$data$a !== void 0 ? _productsQuery$data$a : [],
487
+ cart: (_productsQuery$data$c = productsQuery === null || productsQuery === void 0 || (_productsQuery$data18 = productsQuery.data) === null || _productsQuery$data18 === void 0 ? void 0 : _productsQuery$data18.cart) !== null && _productsQuery$data$c !== void 0 ? _productsQuery$data$c : [],
480
488
  products: {
481
- [_constants__.PRODUCT_CATEGORIES.TOWBAR]: (_productsQuery$data$a2 = productsQuery === null || productsQuery === void 0 || (_productsQuery$data12 = productsQuery.data) === null || _productsQuery$data12 === void 0 || (_productsQuery$data12 = _productsQuery$data12.articles) === null || _productsQuery$data12 === void 0 ? void 0 : _productsQuery$data12.towbars) !== null && _productsQuery$data$a2 !== void 0 ? _productsQuery$data$a2 : [],
482
- [_constants__.PRODUCT_CATEGORIES.CABLESET]: (_productsQuery$data$a3 = productsQuery === null || productsQuery === void 0 || (_productsQuery$data13 = productsQuery.data) === null || _productsQuery$data13 === void 0 || (_productsQuery$data13 = _productsQuery$data13.articles) === null || _productsQuery$data13 === void 0 ? void 0 : _productsQuery$data13.cablesets) !== null && _productsQuery$data$a3 !== void 0 ? _productsQuery$data$a3 : [],
483
- [_constants__.PRODUCT_CATEGORIES.COMBISET]: (_productsQuery$data$a4 = productsQuery === null || productsQuery === void 0 || (_productsQuery$data14 = productsQuery.data) === null || _productsQuery$data14 === void 0 || (_productsQuery$data14 = _productsQuery$data14.articles) === null || _productsQuery$data14 === void 0 ? void 0 : _productsQuery$data14.combisets) !== null && _productsQuery$data$a4 !== void 0 ? _productsQuery$data$a4 : [],
484
- [_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER]: productsQuery !== null && productsQuery !== void 0 && (_productsQuery$data15 = productsQuery.data) !== null && _productsQuery$data15 !== void 0 && (_productsQuery$data15 = _productsQuery$data15.articles) !== null && _productsQuery$data15 !== void 0 && _productsQuery$data15.boardComputerUpdate ? [productsQuery === null || productsQuery === void 0 || (_productsQuery$data16 = productsQuery.data) === null || _productsQuery$data16 === void 0 || (_productsQuery$data16 = _productsQuery$data16.articles) === null || _productsQuery$data16 === void 0 ? void 0 : _productsQuery$data16.boardComputerUpdate] : [],
485
- [_constants__.PRODUCT_CATEGORIES.EXTRAS]: (_productsQuery$data$a5 = productsQuery === null || productsQuery === void 0 || (_productsQuery$data17 = productsQuery.data) === null || _productsQuery$data17 === void 0 || (_productsQuery$data17 = _productsQuery$data17.articles) === null || _productsQuery$data17 === void 0 ? void 0 : _productsQuery$data17.extras) !== null && _productsQuery$data$a5 !== void 0 ? _productsQuery$data$a5 : []
489
+ [_constants__.PRODUCT_CATEGORIES.TOWBAR]: (_productsQuery$data$a2 = productsQuery === null || productsQuery === void 0 || (_productsQuery$data19 = productsQuery.data) === null || _productsQuery$data19 === void 0 || (_productsQuery$data19 = _productsQuery$data19.articles) === null || _productsQuery$data19 === void 0 ? void 0 : _productsQuery$data19.towbars) !== null && _productsQuery$data$a2 !== void 0 ? _productsQuery$data$a2 : [],
490
+ [_constants__.PRODUCT_CATEGORIES.CABLESET]: (_productsQuery$data$a3 = productsQuery === null || productsQuery === void 0 || (_productsQuery$data20 = productsQuery.data) === null || _productsQuery$data20 === void 0 || (_productsQuery$data20 = _productsQuery$data20.articles) === null || _productsQuery$data20 === void 0 ? void 0 : _productsQuery$data20.cablesets) !== null && _productsQuery$data$a3 !== void 0 ? _productsQuery$data$a3 : [],
491
+ [_constants__.PRODUCT_CATEGORIES.COMBISET]: (_productsQuery$data$a4 = productsQuery === null || productsQuery === void 0 || (_productsQuery$data21 = productsQuery.data) === null || _productsQuery$data21 === void 0 || (_productsQuery$data21 = _productsQuery$data21.articles) === null || _productsQuery$data21 === void 0 ? void 0 : _productsQuery$data21.combisets) !== null && _productsQuery$data$a4 !== void 0 ? _productsQuery$data$a4 : [],
492
+ [_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER]: productsQuery !== null && productsQuery !== void 0 && (_productsQuery$data22 = productsQuery.data) !== null && _productsQuery$data22 !== void 0 && (_productsQuery$data22 = _productsQuery$data22.articles) !== null && _productsQuery$data22 !== void 0 && _productsQuery$data22.boardComputerUpdate ? [productsQuery === null || productsQuery === void 0 || (_productsQuery$data23 = productsQuery.data) === null || _productsQuery$data23 === void 0 || (_productsQuery$data23 = _productsQuery$data23.articles) === null || _productsQuery$data23 === void 0 ? void 0 : _productsQuery$data23.boardComputerUpdate] : [],
493
+ [_constants__.PRODUCT_CATEGORIES.EXTRAS]: (_productsQuery$data$a5 = productsQuery === null || productsQuery === void 0 || (_productsQuery$data24 = productsQuery.data) === null || _productsQuery$data24 === void 0 || (_productsQuery$data24 = _productsQuery$data24.articles) === null || _productsQuery$data24 === void 0 ? void 0 : _productsQuery$data24.extras) !== null && _productsQuery$data$a5 !== void 0 ? _productsQuery$data$a5 : []
486
494
  },
487
- totals: (_productsQuery$data$t = productsQuery === null || productsQuery === void 0 || (_productsQuery$data18 = productsQuery.data) === null || _productsQuery$data18 === void 0 ? void 0 : _productsQuery$data18.totals) !== null && _productsQuery$data$t !== void 0 ? _productsQuery$data$t : []
495
+ totals: (_productsQuery$data$t = productsQuery === null || productsQuery === void 0 || (_productsQuery$data25 = productsQuery.data) === null || _productsQuery$data25 === void 0 ? void 0 : _productsQuery$data25.totals) !== null && _productsQuery$data$t !== void 0 ? _productsQuery$data$t : []
488
496
  };
489
497
  };
490
498
 
@@ -4,6 +4,8 @@ require("core-js/modules/es.symbol.description.js");
4
4
  require("core-js/modules/es.array.sort.js");
5
5
  require("core-js/modules/es.json.stringify.js");
6
6
  require("core-js/modules/es.weak-map.js");
7
+ require("core-js/modules/esnext.iterator.constructor.js");
8
+ require("core-js/modules/esnext.iterator.find.js");
7
9
  require("core-js/modules/esnext.iterator.map.js");
8
10
  require("core-js/modules/web.dom-collections.iterator.js");
9
11
  require("core-js/modules/es.weak-map.js");
@@ -14,6 +16,8 @@ exports.default = void 0;
14
16
  require("core-js/modules/es.symbol.description.js");
15
17
  require("core-js/modules/es.array.sort.js");
16
18
  require("core-js/modules/es.json.stringify.js");
19
+ require("core-js/modules/esnext.iterator.constructor.js");
20
+ require("core-js/modules/esnext.iterator.find.js");
17
21
  require("core-js/modules/esnext.iterator.map.js");
18
22
  require("core-js/modules/web.dom-collections.iterator.js");
19
23
  var _react = _interopRequireWildcard(require("react"));
@@ -62,7 +66,7 @@ function _interopRequireWildcard(e, r) {
62
66
  return n.default = e, t && t.set(e, n), n;
63
67
  }
64
68
  const ProductsOverview = () => {
65
- var _products$Trekhaak2, _products$Kabelset, _products$Combiset;
69
+ var _products$Trekhaak3, _products$Kabelset, _products$Combiset;
66
70
  const isProductsInitialLoad = (0, _react.useRef)(true);
67
71
  const formula = (0, _FormulaContext.useFormula)();
68
72
  const isTmg = (0, _useIsTmg.useIsTmg)();
@@ -116,9 +120,9 @@ const ProductsOverview = () => {
116
120
  skipFilters
117
121
  });
118
122
  (0, _react.useEffect)(() => {
119
- var _products$Trekhaak;
123
+ var _products$Trekhaak, _products$Trekhaak2, _products$PRODUCT_CAT3;
120
124
  // Only run this if we have products loaded and no towbar is currently selected
121
- if (!isLoadingProducts && (products === null || products === void 0 || (_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.length) === 1 && !selectedTowbar) {
125
+ if (!isLoadingProducts && (products === null || products === void 0 || (_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.length) === 1 && !selectedTowbar && !selectedCombiset) {
122
126
  var _products$PRODUCT_CAT;
123
127
  const towbarId = products.Trekhaak[0].articleNumber;
124
128
  dispatch({
@@ -139,12 +143,53 @@ const ProductsOverview = () => {
139
143
  });
140
144
  }
141
145
  }
142
- }, [isLoadingProducts, products, selectedTowbar, selectedCableset, dispatch]);
146
+ // If we have multiple towbars, pre-select the recommended one if no other is selected
147
+ else if (!isLoadingProducts && (products === null || products === void 0 || (_products$Trekhaak2 = products.Trekhaak) === null || _products$Trekhaak2 === void 0 ? void 0 : _products$Trekhaak2.length) > 1 && !selectedTowbar && !selectedCombiset) {
148
+ // Find the recommended towbar
149
+ const recommendedTowbar = products.Trekhaak.find(product => (0, _product.checkIfTowbarIsRecommended)({
150
+ product,
151
+ category: _constants__.PRODUCT_CATEGORIES.TOWBAR
152
+ }));
153
+
154
+ // If there's a recommended towbar, select it
155
+ if (recommendedTowbar) {
156
+ var _products$PRODUCT_CAT2;
157
+ dispatch({
158
+ type: _OrderSessionContext.orderSessionActions.SET_SELECTED_TOWBAR,
159
+ payload: {
160
+ towbarId: recommendedTowbar.articleNumber
161
+ }
162
+ });
163
+
164
+ // Auto-select kabelset if no kabelset is currently selected
165
+ if (!selectedCableset && ((_products$PRODUCT_CAT2 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT2 === void 0 ? void 0 : _products$PRODUCT_CAT2.length) === 1) {
166
+ const kabelsetId = products[_constants__.PRODUCT_CATEGORIES.CABLESET][0].articleNumber;
167
+ dispatch({
168
+ type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
169
+ payload: {
170
+ cabelsetId: kabelsetId
171
+ }
172
+ });
173
+ }
174
+ }
175
+ }
176
+
177
+ // Auto-select boardcomputer if one is available and none is currently selected
178
+ if (!isLoadingProducts && (products === null || products === void 0 || (_products$PRODUCT_CAT3 = products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER]) === null || _products$PRODUCT_CAT3 === void 0 ? void 0 : _products$PRODUCT_CAT3.length) > 0 && !selectedBoardComputer && !isBoardComputerDeselected) {
179
+ const boardComputerId = products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER][0].articleNumber;
180
+ dispatch({
181
+ type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BOARDCOMPUTER,
182
+ payload: {
183
+ id: boardComputerId
184
+ }
185
+ });
186
+ }
187
+ }, [isLoadingProducts, products, selectedTowbar, selectedCableset, selectedBoardComputer, isBoardComputerDeselected, dispatch]);
143
188
  if (isLoadingProducts && isProductsInitialLoad.current === true) {
144
189
  isProductsInitialLoad.current = false;
145
190
  return /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null);
146
191
  }
147
- if (isProductsError || !isLoadingProducts && (!(products !== null && products !== void 0 && (_products$Trekhaak2 = products.Trekhaak) !== null && _products$Trekhaak2 !== void 0 && _products$Trekhaak2.length) || !(products !== null && products !== void 0 && (_products$Kabelset = products.Kabelset) !== null && _products$Kabelset !== void 0 && _products$Kabelset.length)) && !(products !== null && products !== void 0 && (_products$Combiset = products.Combiset) !== null && _products$Combiset !== void 0 && _products$Combiset.length)) {
192
+ if (isProductsError || !isLoadingProducts && (!(products !== null && products !== void 0 && (_products$Trekhaak3 = products.Trekhaak) !== null && _products$Trekhaak3 !== void 0 && _products$Trekhaak3.length) || !(products !== null && products !== void 0 && (_products$Kabelset = products.Kabelset) !== null && _products$Kabelset !== void 0 && _products$Kabelset.length)) && !(products !== null && products !== void 0 && (_products$Combiset = products.Combiset) !== null && _products$Combiset !== void 0 && _products$Combiset.length)) {
148
193
  return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
149
194
  to: "/configurator/geen-producten"
150
195
  });
@@ -176,9 +221,9 @@ const ProductsOverview = () => {
176
221
 
177
222
  // Auto-select kabelset if towbar is selected and no kabelset is currently selected
178
223
  if (isSelected && !selectedCableset) {
179
- var _products$PRODUCT_CAT2;
224
+ var _products$PRODUCT_CAT4;
180
225
  // Check if there's exactly one kabelset available
181
- if (((_products$PRODUCT_CAT2 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT2 === void 0 ? void 0 : _products$PRODUCT_CAT2.length) === 1) {
226
+ if (((_products$PRODUCT_CAT4 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT4 === void 0 ? void 0 : _products$PRODUCT_CAT4.length) === 1) {
182
227
  const kabelsetId = products[_constants__.PRODUCT_CATEGORIES.CABLESET][0].articleNumber;
183
228
  dispatch({
184
229
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/esnext.iterator.constructor.js");
4
+ require("core-js/modules/esnext.iterator.filter.js");
3
5
  require("core-js/modules/esnext.iterator.map.js");
4
6
  require("core-js/modules/web.dom-collections.iterator.js");
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports.default = void 0;
11
+ require("core-js/modules/esnext.iterator.constructor.js");
12
+ require("core-js/modules/esnext.iterator.filter.js");
9
13
  require("core-js/modules/esnext.iterator.map.js");
10
14
  require("core-js/modules/web.dom-collections.iterator.js");
11
15
  var _lodash = require("lodash");
@@ -19,6 +23,7 @@ var _FormulaContext = require("../__context__/FormulaContext");
19
23
  var _OrderSessionContext = require("../__context__/OrderSessionContext");
20
24
  var _helpers__ = require("../__helpers__");
21
25
  var _image = require("../__helpers__/image");
26
+ var _useIsTmg = require("../__hooks__/useIsTmg");
22
27
  function _interopRequireDefault(e) {
23
28
  return e && e.__esModule ? e : {
24
29
  default: e
@@ -39,6 +44,7 @@ const VehicleData = _ref => {
39
44
  singleOrderFormulaCode,
40
45
  existingDossierId
41
46
  }] = (0, _OrderSessionContext.useOrderSession)();
47
+ const isTmg = (0, _useIsTmg.useIsTmg)();
42
48
  let formula = (0, _FormulaContext.useFormula)();
43
49
  if (isFilter && singleOrderFormulaCode) {
44
50
  formula = singleOrderFormulaCode;
@@ -84,8 +90,11 @@ const VehicleData = _ref => {
84
90
  className: (0, _helpers__.withStyle)('license-plate__edit link-primary col-12'),
85
91
  type: "button"
86
92
  })),
87
- expandedBody: Object.entries(vehicleDetails).map(_ref2 => {
88
- let [key, value] = _ref2;
93
+ expandedBody: Object.entries(vehicleDetails).filter(_ref2 => {
94
+ let [key] = _ref2;
95
+ return isTmg || key !== 'kType' && key !== 'kMod';
96
+ }).map(_ref3 => {
97
+ let [key, value] = _ref3;
89
98
  if (!value) {
90
99
  return null;
91
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.157",
3
+ "version": "0.0.159",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",