thm-p3-configurator 0.0.292 → 0.0.293

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.
@@ -21,14 +21,17 @@ const ProductCardPrice = _ref => {
21
21
  className: (0, _helpers__.withStyle)('card__price')
22
22
  }, (0, _helpers__.formatPrice)(price));
23
23
  }
24
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, discountedPrice < price ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
25
- className: (0, _helpers__.withStyle)('card__price')
26
- }, /*#__PURE__*/_react.default.createElement("span", {
27
- className: (0, _helpers__.withStyle)('strikethrough card-price-label')
28
- }, (0, _helpers__.formatPrice)(price))), /*#__PURE__*/_react.default.createElement("div", {
29
- className: (0, _helpers__.withStyle)('card__price text-danger')
30
- }, (0, _helpers__.formatPrice)(discountedPrice))) : /*#__PURE__*/_react.default.createElement("div", {
24
+ if (discountedPrice < price) {
25
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
26
+ className: (0, _helpers__.withStyle)('card__price')
27
+ }, /*#__PURE__*/_react.default.createElement("span", {
28
+ className: (0, _helpers__.withStyle)('strikethrough card-price-label')
29
+ }, (0, _helpers__.formatPrice)(price))), /*#__PURE__*/_react.default.createElement("div", {
30
+ className: (0, _helpers__.withStyle)('card__price text-danger')
31
+ }, (0, _helpers__.formatPrice)(discountedPrice)));
32
+ }
33
+ return /*#__PURE__*/_react.default.createElement("div", {
31
34
  className: (0, _helpers__.withStyle)('card__price')
32
- }, (0, _helpers__.formatPrice)(price)));
35
+ }, (0, _helpers__.formatPrice)(price));
33
36
  };
34
37
  var _default = exports.default = ProductCardPrice;
@@ -21,6 +21,7 @@ var _queries = require("../__api__/queries");
21
21
  var _ProductCard = _interopRequireDefault(require("../__components__/ProductCard"));
22
22
  var _InlineSpinner = _interopRequireDefault(require("../__components__/Spinners/InlineSpinner"));
23
23
  var _constants__ = require("../__constants__");
24
+ var _cartTable = require("../__constants__/cartTable");
24
25
  var _FormulaContext = require("../__context__/FormulaContext");
25
26
  var _OrderSessionContext = require("../__context__/OrderSessionContext");
26
27
  var _helpers__ = require("../__helpers__");
@@ -168,7 +169,24 @@ const ExtraProductsOverview = () => {
168
169
  className: (0, _helpers__.withStyle)(index === 0 ? 'mt-0' : 'mt-5'),
169
170
  key: "category-".concat(item.categoryName)
170
171
  }, /*#__PURE__*/_react.default.createElement("h2", null, item.categoryName), item.products.map((product, index) => {
171
- var _product$locationPric, _product$images, _product$images2, _product$boldDescript;
172
+ var _product$consumerPric, _product$consumerPric2, _product$locationPric, _product$images, _product$images2, _product$boldDescript;
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
+ }
172
190
  return /*#__PURE__*/_react.default.createElement(_ProductCard.default, {
173
191
  isTmg: isTmg,
174
192
  stock: product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.stock,
@@ -194,9 +212,9 @@ const ExtraProductsOverview = () => {
194
212
  productCategory
195
213
  });
196
214
  },
197
- productDiscountedPrice: product !== null && product !== void 0 && product.fromPrice ? product.price : null,
215
+ productDiscountedPrice: resolvedProductDiscountedPrice,
198
216
  productDiscountedLabel: (_product$boldDescript = product.boldDescription) === null || _product$boldDescript === void 0 ? void 0 : _product$boldDescript.ops[0].insert,
199
- productPrice: product.fromPrice || product.price,
217
+ productPrice: resolvedProductPrice,
200
218
  productSpecifications: product.specifications ? (0, _product.extractProductSpecsArray)(product.specifications) : [],
201
219
  showPrice: true
202
220
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.292",
3
+ "version": "0.0.293",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",