thm-p3-configurator 0.0.34 → 0.0.36

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.
@@ -171,7 +171,7 @@ const AppointmentForm = () => {
171
171
  licensePlate: licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.replace(/-/g, ''),
172
172
  model,
173
173
  answers: (0, _helpers__.removeNullishProps)({
174
- duration: durationAnswer || (vehicleDetails === null || vehicleDetails === void 0 ? void 0 : vehicleDetails.duration),
174
+ duration: durationAnswer,
175
175
  execution1: executionAnswer1,
176
176
  execution2: executionAnswer2
177
177
  }),
@@ -183,7 +183,7 @@ const ExitIntentModal = () => {
183
183
  licensePlate,
184
184
  model,
185
185
  answers: (0, _helpers__.removeNullishProps)({
186
- duration: durationAnswer || vehicleDetails.duration,
186
+ duration: durationAnswer,
187
187
  execution1: executionAnswer1,
188
188
  execution2: executionAnswer2
189
189
  }),
@@ -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,
@@ -164,7 +164,7 @@ const QuotationForm = () => {
164
164
  licensePlate,
165
165
  model,
166
166
  answers: (0, _helpers__.removeNullishProps)({
167
- duration: durationAnswer || (vehicleDetails === null || vehicleDetails === void 0 ? void 0 : vehicleDetails.duration),
167
+ duration: durationAnswer,
168
168
  execution1: executionAnswer1,
169
169
  execution2: executionAnswer2
170
170
  }),
@@ -250,7 +250,7 @@ const InternalAppointmentForm = _ref => {
250
250
  model,
251
251
  priceCalculationDate,
252
252
  answers: (0, _helpers__.removeNullishProps)({
253
- duration: durationAnswer || (vehicleDetails === null || vehicleDetails === void 0 ? void 0 : vehicleDetails.duration),
253
+ duration: durationAnswer,
254
254
  execution1: executionAnswer1,
255
255
  execution2: executionAnswer2
256
256
  }),
@@ -235,7 +235,7 @@ const InternalQuotationForm = _ref => {
235
235
  licensePlate: (_ref2 = licensePlate || _licensePlate) === null || _ref2 === void 0 ? void 0 : _ref2.replace(/-/g, ''),
236
236
  model,
237
237
  answers: (0, _helpers__.removeNullishProps)({
238
- duration: durationAnswer || (vehicleDetails === null || vehicleDetails === void 0 ? void 0 : vehicleDetails.duration),
238
+ duration: durationAnswer,
239
239
  execution1: executionAnswer1,
240
240
  execution2: executionAnswer2
241
241
  }),
@@ -102,7 +102,7 @@ const INITIAL_ORDER_SESSION_STATE = {
102
102
  model: null,
103
103
  brand: null,
104
104
  channel: null,
105
- durationAnswer: null,
105
+ durationAnswer: undefined,
106
106
  executionAnswer1: null,
107
107
  executionAnswer2: null,
108
108
  priceCalculationDate: new Date().getTime(),
@@ -211,7 +211,7 @@ const orderSessionReducer = (state, action) => {
211
211
  buildYear: null,
212
212
  model: null,
213
213
  brand: null,
214
- durationAnswer: null,
214
+ durationAnswer: undefined,
215
215
  executionAnswer1: null,
216
216
  executionAnswer2: null,
217
217
  durationOptions: [],
@@ -765,7 +765,7 @@ const orderSessionReducer = (state, action) => {
765
765
  {
766
766
  return _objectSpread(_objectSpread({}, state), {}, {
767
767
  answers: {},
768
- durationAnswer: null
768
+ durationAnswer: undefined
769
769
  });
770
770
  }
771
771
  case orderSessionActions.SET_PRICE_CALCULATION_DATE:
@@ -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.36",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",