thm-p3-configurator 0.0.294 → 0.0.295

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.
@@ -41,7 +41,7 @@ const ProductCardDiscountAlert = _ref => {
41
41
  price,
42
42
  discountedPrice
43
43
  } = _ref;
44
- if (!discountedPrice || !price) {
44
+ if (!discountedPrice || !price || discountedPrice >= price) {
45
45
  return null;
46
46
  }
47
47
  const discountLabel = (0, _react.useMemo)(() => {
@@ -119,8 +119,8 @@ const ProductCard = _ref => {
119
119
  isBoardComputer: isBoardComputer
120
120
  }), /*#__PURE__*/_react.default.createElement(_ProductCardDiscountAlert.default, {
121
121
  label: productDiscountedLabel,
122
- price: productPrice,
123
- discountedPrice: productDiscountedPrice
122
+ price: productDiscountedPrice,
123
+ discountedPrice: productPrice
124
124
  })), /*#__PURE__*/_react.default.createElement("div", {
125
125
  className: (0, _helpers__.withStyle)("".concat(productImage ? 'col-md-8' : 'col-12', " d-flex flex-wrap"))
126
126
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -130,8 +130,8 @@ const ProductCard = _ref => {
130
130
  }, productTitle, showPrice && /*#__PURE__*/_react.default.createElement("div", {
131
131
  className: (0, _helpers__.withStyle)('col-12 col-md-auto d-flex flex-xxl-column my-2 my-xxl-0')
132
132
  }, /*#__PURE__*/_react.default.createElement(_ProductCardPrice.default, {
133
- price: productPrice,
134
- discountedPrice: productDiscountedPrice
133
+ price: productDiscountedPrice < productPrice ? productPrice : productDiscountedPrice,
134
+ discountedPrice: productDiscountedPrice < productPrice ? productDiscountedPrice : productPrice
135
135
  }))), /*#__PURE__*/_react.default.createElement("div", {
136
136
  className: (0, _helpers__.withStyle)('card-text row no-gutters flex-wrap align-items-bottom justify-content-start')
137
137
  }, /*#__PURE__*/_react.default.createElement(_ProductCardUsps.default, {
@@ -169,24 +169,14 @@ const ExtraProductsOverview = () => {
169
169
  className: (0, _helpers__.withStyle)(index === 0 ? 'mt-0' : 'mt-5'),
170
170
  key: "category-".concat(item.categoryName)
171
171
  }, /*#__PURE__*/_react.default.createElement("h2", null, item.categoryName), item.products.map((product, index) => {
172
- var _product$consumerPric, _product$consumerPric2, _product$locationPric, _product$images, _product$images2, _product$boldDescript;
172
+ var _product$consumerPric, _product$price, _product$locationPric, _product$images, _product$images2, _product$boldDescript;
173
173
  const isSelectedExtra = selectedExtras.hasOwnProperty(product.articleNumber);
174
- const salesPriceInclVat = product === null || product === void 0 || (_product$consumerPric = product.consumerPrices) === null || _product$consumerPric === void 0 ? void 0 : _product$consumerPric.priceInclVat;
175
- const listPriceExclVat = product === null || product === void 0 || (_product$consumerPric2 = product.consumerPrices) === null || _product$consumerPric2 === void 0 ? void 0 : _product$consumerPric2.listPriceExclVat;
176
- const hasSalesPriceInclVat = salesPriceInclVat != null && !Number.isNaN(Number(salesPriceInclVat));
177
- const resolvedSalesPriceInclVat = hasSalesPriceInclVat ? Number(salesPriceInclVat) : null;
178
- const resolvedListPriceInclVat = listPriceExclVat != null && !Number.isNaN(Number(listPriceExclVat)) ? Number(listPriceExclVat) * _cartTable.VAT_RATE : null;
179
- let resolvedProductPrice = (product === null || product === void 0 ? void 0 : product.fromPrice) || (product === null || product === void 0 ? void 0 : product.price);
180
- let resolvedProductDiscountedPrice = product !== null && product !== void 0 && product.fromPrice ? product === null || product === void 0 ? void 0 : product.price : null;
181
- if (hasSalesPriceInclVat) {
182
- if (resolvedListPriceInclVat != null && resolvedListPriceInclVat > resolvedSalesPriceInclVat) {
183
- resolvedProductPrice = resolvedListPriceInclVat;
184
- resolvedProductDiscountedPrice = resolvedSalesPriceInclVat;
185
- } else {
186
- resolvedProductPrice = resolvedSalesPriceInclVat;
187
- resolvedProductDiscountedPrice = null;
188
- }
189
- }
174
+
175
+ // Determine main price (incl. VAT) from consumerPrices, or fallback to product.price if missing
176
+ const resolvedProductPrice = typeof (product === null || product === void 0 || (_product$consumerPric = product.consumerPrices) === null || _product$consumerPric === void 0 ? void 0 : _product$consumerPric.priceInclVat) === 'number' ? product.consumerPrices.priceInclVat : (_product$price = product === null || product === void 0 ? void 0 : product.price) !== null && _product$price !== void 0 ? _product$price : null;
177
+
178
+ // Only show fromPrice if it's provided (not undefined/null/empty)
179
+ const resolvedProductDiscountedPrice = typeof (product === null || product === void 0 ? void 0 : product.fromPrice) === 'number' ? product.fromPrice : 0;
190
180
  return /*#__PURE__*/_react.default.createElement(_ProductCard.default, {
191
181
  isTmg: isTmg,
192
182
  stock: product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.stock,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.294",
3
+ "version": "0.0.295",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",