thm-p3-configurator 0.0.34 → 0.0.35

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.
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.symbol.description.js");
3
4
  require("core-js/modules/es.array.includes.js");
5
+ require("core-js/modules/es.array.sort.js");
4
6
  require("core-js/modules/es.json.stringify.js");
5
7
  require("core-js/modules/es.string.includes.js");
6
8
  require("core-js/modules/es.weak-map.js");
@@ -11,7 +13,9 @@ Object.defineProperty(exports, "__esModule", {
11
13
  value: true
12
14
  });
13
15
  exports.default = void 0;
16
+ require("core-js/modules/es.symbol.description.js");
14
17
  require("core-js/modules/es.array.includes.js");
18
+ require("core-js/modules/es.array.sort.js");
15
19
  require("core-js/modules/es.json.stringify.js");
16
20
  require("core-js/modules/es.string.includes.js");
17
21
  require("core-js/modules/esnext.iterator.map.js");
@@ -173,8 +177,15 @@ const ProductsOverview = () => {
173
177
  return /*#__PURE__*/_react.default.createElement("div", {
174
178
  className: (0, _helpers__.withStyle)(index === 0 ? 'mt-0' : 'mt-5'),
175
179
  key: "category-".concat(productCategory)
176
- }, /*#__PURE__*/_react.default.createElement("h2", null, productCategory), productsPerCategory.map(product => {
180
+ }, /*#__PURE__*/_react.default.createElement("h2", null, productCategory), productsPerCategory.sort((a, b) => (0, _product.checkIfTowbarIsRecommended)({
181
+ product: a,
182
+ category: productCategory
183
+ }) ? -1 : 0).map(product => {
177
184
  var _product$images, _product$images2;
185
+ const isRecommended = (0, _product.checkIfTowbarIsRecommended)({
186
+ product,
187
+ category: productCategory
188
+ });
178
189
  if (productCategory === _constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER && selectedCableset) {
179
190
  return /*#__PURE__*/_react.default.createElement(_BoardComputerCard.default, {
180
191
  defaultSelected: !isBoardComputerDeselected || selectedBoardComputer === product.articleNumber,
@@ -191,7 +202,7 @@ const ProductsOverview = () => {
191
202
  },
192
203
  key: product.articleNumber,
193
204
  id: product.articleNumber,
194
- description: "Bij deze auto is het noodzakelijk om de boordcomputer te updaten, zodat functies als ESP, \n parkeersensoren, mistlampuitschakeling, lane-assist, e.a. correct blijven werken.",
205
+ description: (0, _product.formatHyperDescription)(product === null || product === void 0 ? void 0 : product.description),
195
206
  title: product === null || product === void 0 ? void 0 : product.title,
196
207
  price: product === null || product === void 0 ? void 0 : product.price
197
208
  });
@@ -199,7 +210,7 @@ const ProductsOverview = () => {
199
210
  return /*#__PURE__*/_react.default.createElement(_ProductCard.default, {
200
211
  key: product.articleNumber,
201
212
  hasCheckbox: (productsPerCategory === null || productsPerCategory === void 0 ? void 0 : productsPerCategory.length) > 1,
202
- isRecommended: false,
213
+ isRecommended: isRecommended,
203
214
  productId: product === null || product === void 0 ? void 0 : product.articleNumber,
204
215
  productTitle: product === null || product === void 0 ? void 0 : product.title,
205
216
  productDescription: product === null || product === void 0 ? void 0 : product.productDescription,
@@ -7,11 +7,12 @@ require("core-js/modules/es.string.includes.js");
7
7
  require("core-js/modules/esnext.iterator.constructor.js");
8
8
  require("core-js/modules/esnext.iterator.filter.js");
9
9
  require("core-js/modules/esnext.iterator.flat-map.js");
10
+ require("core-js/modules/esnext.iterator.map.js");
10
11
  require("core-js/modules/web.dom-collections.iterator.js");
11
12
  Object.defineProperty(exports, "__esModule", {
12
13
  value: true
13
14
  });
14
- exports.validateCartInput = exports.extractProductSpecsArray = void 0;
15
+ exports.validateCartInput = exports.formatHyperDescription = exports.extractProductSpecsArray = exports.checkIfTowbarIsRecommended = void 0;
15
16
  require("core-js/modules/es.array.flat-map.js");
16
17
  require("core-js/modules/es.array.includes.js");
17
18
  require("core-js/modules/es.array.unscopables.flat-map.js");
@@ -19,6 +20,7 @@ require("core-js/modules/es.string.includes.js");
19
20
  require("core-js/modules/esnext.iterator.constructor.js");
20
21
  require("core-js/modules/esnext.iterator.filter.js");
21
22
  require("core-js/modules/esnext.iterator.flat-map.js");
23
+ require("core-js/modules/esnext.iterator.map.js");
22
24
  require("core-js/modules/web.dom-collections.iterator.js");
23
25
  var _constants__ = require("../__constants__");
24
26
  /**
@@ -48,4 +50,25 @@ const validateCartInput = exports.validateCartInput = function validateCartInput
48
50
  return filteredCart;
49
51
  }
50
52
  return;
51
- };
53
+ };
54
+
55
+ /**
56
+ * @description Checks if a product is recommended, by checking if it both a towbar and is detachable
57
+ */
58
+ const checkIfTowbarIsRecommended = _ref3 => {
59
+ var _product$subgroupName;
60
+ let {
61
+ product,
62
+ category
63
+ } = _ref3;
64
+ return category === _constants__.PRODUCT_CATEGORIES.TOWBAR && ((product === null || product === void 0 ? void 0 : product.subgroupName.toLowerCase().includes('afneembaar')) || (product === null || product === void 0 || (_product$subgroupName = product.subgroupName) === null || _product$subgroupName === void 0 ? void 0 : _product$subgroupName.toLowerCase().includes('afneembare')));
65
+ };
66
+
67
+ /**
68
+ * @description Formats the description of a product
69
+ */
70
+ exports.checkIfTowbarIsRecommended = checkIfTowbarIsRecommended;
71
+ const formatHyperDescription = description => {
72
+ return description === null || description === void 0 ? void 0 : description.ops.map(phrase => phrase.insert).join('');
73
+ };
74
+ exports.formatHyperDescription = formatHyperDescription;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",