thm-p3-configurator 0.0.443 → 0.0.445

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.
@@ -109,7 +109,6 @@ const ProductCard = _ref => {
109
109
  isRecommended = false,
110
110
  productId,
111
111
  productTitle,
112
- productOrientation,
113
112
  productDescription,
114
113
  stock = null,
115
114
  productUsps = [],
@@ -187,9 +186,7 @@ const ProductCard = _ref => {
187
186
  }, /*#__PURE__*/_react.default.createElement(_ProductCardPrice.default, {
188
187
  price: productDiscountedPrice < productPrice ? productPrice : productDiscountedPrice,
189
188
  discountedPrice: productDiscountedPrice < productPrice ? productDiscountedPrice : productPrice
190
- }))), productOrientation && /*#__PURE__*/_react.default.createElement("p", {
191
- className: (0, _helpers__.withStyle)('card-title__orientation')
192
- }, /*#__PURE__*/_react.default.createElement("strong", null, productOrientation)), /*#__PURE__*/_react.default.createElement("div", {
189
+ }))), /*#__PURE__*/_react.default.createElement("div", {
193
190
  className: (0, _helpers__.withStyle)('card-text row no-gutters flex-wrap align-items-bottom justify-content-start')
194
191
  }, /*#__PURE__*/_react.default.createElement(_ProductCardUsps.default, {
195
192
  usps: productUsps
@@ -109,8 +109,7 @@ const ProductCartSide = () => {
109
109
  montageRate,
110
110
  extraPriceAmount,
111
111
  discountCode,
112
- priceCalculationDate,
113
- skipFilters
112
+ priceCalculationDate
114
113
  } = order;
115
114
  const isTmg = (0, _useIsTmg.useIsTmg)();
116
115
  const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
@@ -129,9 +128,7 @@ const ProductCartSide = () => {
129
128
  consumerDiscounts,
130
129
  touchedConsumerDiscounts
131
130
  });
132
- // Use the session skipFilters so this query matches the product page's;
133
- // an unfiltered request can return a different catalogue than the page.
134
- const shouldRequestUnfilteredProducts = skipFilters || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
131
+ const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput) || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
135
132
  const {
136
133
  cart,
137
134
  totals,
@@ -280,8 +280,7 @@ const ProductCartTable = () => {
280
280
  touchedConsumerDiscounts,
281
281
  montageRate,
282
282
  isMontageTariffFixed,
283
- extraPriceAmount,
284
- skipFilters
283
+ extraPriceAmount
285
284
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
286
285
 
287
286
  // Determine display mode
@@ -355,9 +354,10 @@ const ProductCartTable = () => {
355
354
  consumerDiscounts,
356
355
  touchedConsumerDiscounts
357
356
  });
358
- // Use the session skipFilters so this query matches the product page's;
359
- // an unfiltered request can return a different catalogue than the page.
360
- const shouldRequestUnfilteredProducts = skipFilters || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
357
+ // Also request unfiltered products when editing an existing dossier with
358
+ // article numbers that could not be classified into selectedTowbar etc. during
359
+ // hydration (e.g. formula-specific articles not in the TM catalogue).
360
+ const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput) || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
361
361
  const durationAnswerForQuery = durationAnswerIsPrefilled ? undefined : durationAnswer;
362
362
  const {
363
363
  cart,
@@ -456,7 +456,6 @@ const ProductsOverview = () => {
456
456
  })
457
457
  });
458
458
  }
459
- const towbarOrientation = !APP_CONFIG.internal && (productCategory === _constants__.PRODUCT_CATEGORIES.TOWBAR || productCategory === _constants__.PRODUCT_CATEGORIES.COMBISET) ? (0, _product.getDetachableTowbarOrientation)(product === null || product === void 0 ? void 0 : product.subgroupName) : null;
460
459
  return /*#__PURE__*/_react.default.createElement(_ProductCard.default, {
461
460
  isTmg: isTmg,
462
461
  stock: (_product$consumerPric = product === null || product === void 0 || (_product$consumerPric2 = product.consumerPrices) === null || _product$consumerPric2 === void 0 ? void 0 : _product$consumerPric2.stock) !== null && _product$consumerPric !== void 0 ? _product$consumerPric : product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.stock,
@@ -464,8 +463,7 @@ const ProductsOverview = () => {
464
463
  hasCheckbox: (productsPerCategory === null || productsPerCategory === void 0 ? void 0 : productsPerCategory.length) > 1,
465
464
  isRecommended: isRecommended,
466
465
  productId: product === null || product === void 0 ? void 0 : product.articleNumber,
467
- productTitle: towbarOrientation ? (0, _product.getTowbarInfoTitle)(product === null || product === void 0 ? void 0 : product.subgroupName) : product === null || product === void 0 ? void 0 : product.subgroupName,
468
- productOrientation: towbarOrientation,
466
+ productTitle: product === null || product === void 0 ? void 0 : product.subgroupName,
469
467
  productDescription: product === null || product === void 0 ? void 0 : product.productDescription,
470
468
  productUsps: [{
471
469
  type: 'excl',
@@ -46,15 +46,4 @@ describe('product helpers', () => {
46
46
  expect(result.priceInclVat).toBe(189);
47
47
  expect(result.priceExclVat).toBeCloseTo(156.2, 2);
48
48
  });
49
- });
50
- describe('getDetachableTowbarOrientation', () => {
51
- it('returns horizontaal or verticaal for detachable towbars', () => {
52
- expect((0, _product.getDetachableTowbarOrientation)('Trekhaken horizontaal afneembaar')).toBe('horizontaal');
53
- expect((0, _product.getDetachableTowbarOrientation)('Trekhaken verticaal afneembaar')).toBe('verticaal');
54
- });
55
- it('does not infer a type for other hitch names', () => {
56
- expect((0, _product.getDetachableTowbarOrientation)('Afneembare trekhaak')).toBeNull();
57
- expect((0, _product.getDetachableTowbarOrientation)('Trekhaken vast')).toBeNull();
58
- expect((0, _product.getDetachableTowbarOrientation)('')).toBeNull();
59
- });
60
49
  });
@@ -9,11 +9,12 @@ require("core-js/modules/esnext.iterator.filter.js");
9
9
  require("core-js/modules/esnext.iterator.flat-map.js");
10
10
  require("core-js/modules/esnext.iterator.for-each.js");
11
11
  require("core-js/modules/esnext.iterator.map.js");
12
+ require("core-js/modules/esnext.iterator.some.js");
12
13
  require("core-js/modules/web.dom-collections.iterator.js");
13
14
  Object.defineProperty(exports, "__esModule", {
14
15
  value: true
15
16
  });
16
- exports.validateCartInput = exports.shouldSelectBoardComputerUpdate = exports.resolveSingleOrderArticlePrices = exports.parseProductSpecifications = exports.getTowbarInfoTitle = exports.getEffectiveBoardComputerSelection = exports.getDetachableTowbarOrientation = exports.formatHyperDescription = exports.extractProductSpecsArray = exports.checkIfTowbarIsRecommended = exports.buildCartInput = void 0;
17
+ exports.validateCartInput = exports.shouldSelectBoardComputerUpdate = exports.shouldRequestUnfilteredProductsForCart = exports.resolveSingleOrderArticlePrices = exports.parseProductSpecifications = exports.getEffectiveBoardComputerSelection = exports.formatHyperDescription = exports.extractProductSpecsArray = exports.checkIfTowbarIsRecommended = exports.buildCartInput = void 0;
17
18
  require("core-js/modules/es.array.flat-map.js");
18
19
  require("core-js/modules/es.array.includes.js");
19
20
  require("core-js/modules/es.array.unscopables.flat-map.js");
@@ -23,6 +24,7 @@ require("core-js/modules/esnext.iterator.filter.js");
23
24
  require("core-js/modules/esnext.iterator.flat-map.js");
24
25
  require("core-js/modules/esnext.iterator.for-each.js");
25
26
  require("core-js/modules/esnext.iterator.map.js");
27
+ require("core-js/modules/esnext.iterator.some.js");
26
28
  require("core-js/modules/web.dom-collections.iterator.js");
27
29
  var _constants__ = require("../__constants__");
28
30
  function ownKeys(e, r) {
@@ -96,6 +98,16 @@ const validateCartInput = exports.validateCartInput = function validateCartInput
96
98
  }
97
99
  return;
98
100
  };
101
+
102
+ /**
103
+ * @description Cart overviews resolve selected articles from the order article lists.
104
+ * If the user selected an article that only appears with skipFilters enabled,
105
+ * those read-only lookups must request the unfiltered product list too.
106
+ */
107
+ const shouldRequestUnfilteredProductsForCart = exports.shouldRequestUnfilteredProductsForCart = function shouldRequestUnfilteredProductsForCart() {
108
+ let cart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
109
+ return Array.isArray(cart) && cart.some(lineItem => (lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber) != null);
110
+ };
99
111
  const getEffectiveBoardComputerSelection = exports.getEffectiveBoardComputerSelection = function getEffectiveBoardComputerSelection() {
100
112
  var _ref3;
101
113
  let {
@@ -215,39 +227,11 @@ const checkIfTowbarIsRecommended = _ref8 => {
215
227
  } = _ref8;
216
228
  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')));
217
229
  };
218
- exports.checkIfTowbarIsRecommended = checkIfTowbarIsRecommended;
219
- const getTowbarInfoTitle = title => {
220
- const lower = (title || '').toLowerCase();
221
- if (lower.includes('afneemba')) {
222
- return 'Afneembare trekhaak';
223
- }
224
- if (lower.includes('wegklapba') || lower.includes('wegdraai')) {
225
- return 'Wegklapbare trekhaak';
226
- }
227
- if (lower.includes('vast')) {
228
- return 'Vaste trekhaak';
229
- }
230
- return title;
231
- };
232
- exports.getTowbarInfoTitle = getTowbarInfoTitle;
233
- const getDetachableTowbarOrientation = title => {
234
- const lower = (title || '').toLowerCase();
235
- if (!lower.includes('afneemba')) {
236
- return null;
237
- }
238
- if (lower.includes('horizontaal')) {
239
- return 'horizontaal';
240
- }
241
- if (lower.includes('verticaal')) {
242
- return 'verticaal';
243
- }
244
- return null;
245
- };
246
230
 
247
231
  /**
248
232
  * @description Formats the description of a product
249
233
  */
250
- exports.getDetachableTowbarOrientation = getDetachableTowbarOrientation;
234
+ exports.checkIfTowbarIsRecommended = checkIfTowbarIsRecommended;
251
235
  const formatHyperDescription = description => {
252
236
  return description === null || description === void 0 ? void 0 : description.ops.map(phrase => phrase.insert).join('');
253
237
  };
@@ -22,12 +22,6 @@ Card Horizontal
22
22
  @extend .d-flex, .justify-content-between;
23
23
  }
24
24
 
25
- .card-title__orientation {
26
- font-size: 0.85rem;
27
- font-weight: 700;
28
- margin-bottom: 0.5rem;
29
- }
30
-
31
25
  .card-img__best-choice {
32
26
  z-index: 2;
33
27
  width: 50%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.443",
3
+ "version": "0.0.445",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",