thm-p3-configurator 0.0.221 → 0.0.223

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.
@@ -199,7 +199,8 @@ const ProductCartTable = () => {
199
199
  salesPrice: 0,
200
200
  salesPriceInclVat: 0,
201
201
  margin: 0,
202
- marginPercentage: 0
202
+ marginPercentage: 0,
203
+ hasLocationTotal: false
203
204
  };
204
205
  }
205
206
  if (!product) {
@@ -207,16 +208,18 @@ const ProductCartTable = () => {
207
208
  purchasePrice: 0,
208
209
  salesPrice: 0,
209
210
  margin: 0,
210
- marginPercentage: 0
211
+ marginPercentage: 0,
212
+ hasLocationTotal: false
211
213
  };
212
214
  }
213
215
  let purchasePrice = 0;
214
216
  let salesPrice = 0;
217
+ const hasLocationTotal = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== undefined && (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== null;
215
218
 
216
219
  // Get prices directly from product objects
217
220
  if (APP_CONFIG.internal) {
218
221
  purchasePrice = cartItem !== null && cartItem !== void 0 && cartItem.locationTotal ? cartItem.locationTotal : (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) || 0;
219
- salesPrice = isToggled ? (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) / 1.21 : (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) || 0;
222
+ salesPrice = isToggled ? (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) / 1.21 : cartItem !== null && cartItem !== void 0 && cartItem.locationTotal ? cartItem.locationTotal : (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) || 0;
220
223
  } else {
221
224
  purchasePrice = (product === null || product === void 0 ? void 0 : product.price) || 0;
222
225
  salesPrice = (product === null || product === void 0 ? void 0 : product.price) || 0;
@@ -225,7 +228,8 @@ const ProductCartTable = () => {
225
228
  return {
226
229
  purchasePrice,
227
230
  salesPrice,
228
- margin
231
+ margin,
232
+ hasLocationTotal
229
233
  };
230
234
  };
231
235
  if (products) {
@@ -300,7 +304,8 @@ const ProductCartTable = () => {
300
304
  purchasePrice,
301
305
  salesPrice,
302
306
  margin,
303
- marginPercentage
307
+ marginPercentage,
308
+ hasLocationTotal
304
309
  } = product.priceInfo;
305
310
  return /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
306
311
  key: product.articleNumber,
@@ -309,10 +314,10 @@ const ProductCartTable = () => {
309
314
  imageId: (_product$images2 = product.images) === null || _product$images2 === void 0 ? void 0 : _product$images2[0]
310
315
  }) : _logoPrimary.default,
311
316
  extraCells: [{}, {}, {}, ...(isToggled ? [{
312
- text: (0, _helpers__.formatPrice)(margin),
317
+ text: hasLocationTotal ? (0, _helpers__.formatPrice)(margin) : 'N.v.t.',
313
318
  className: 'cart__table-price text-end'
314
319
  }, {
315
- text: (0, _helpers__.formatPrice)(purchasePrice),
320
+ text: hasLocationTotal ? (0, _helpers__.formatPrice)(purchasePrice) : 'N.v.t.',
316
321
  className: 'cart__table-price text-end'
317
322
  }, {
318
323
  text: (0, _helpers__.formatPrice)(salesPrice),
@@ -389,7 +394,8 @@ const ProductCartTable = () => {
389
394
  purchasePrice,
390
395
  salesPrice,
391
396
  margin,
392
- marginPercentage
397
+ marginPercentage,
398
+ hasLocationTotal
393
399
  } = product.priceInfo;
394
400
  let canProductBeAltered = canAlterQuantity;
395
401
  if (!canAlterQuantity && !(allArticleNumbers !== null && allArticleNumbers !== void 0 && allArticleNumbers.includes(product.articleNumber))) {
@@ -403,10 +409,10 @@ const ProductCartTable = () => {
403
409
  imageId: (_product$images4 = product.images) === null || _product$images4 === void 0 ? void 0 : _product$images4[0]
404
410
  }) : _logoPrimary.default,
405
411
  extraCells: [{}, {}, {}, ...(isToggled ? [{
406
- text: (0, _helpers__.formatPrice)(margin),
412
+ text: hasLocationTotal ? (0, _helpers__.formatPrice)(margin) : 'N.v.t.',
407
413
  className: 'cart__table-price text-end'
408
414
  }, {
409
- text: (0, _helpers__.formatPrice)(purchasePrice),
415
+ text: hasLocationTotal ? (0, _helpers__.formatPrice)(purchasePrice) : 'N.v.t.',
410
416
  className: 'cart__table-price text-end'
411
417
  }, {
412
418
  text: (0, _helpers__.formatPrice)(salesPrice),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.221",
3
+ "version": "0.0.223",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",