thm-p3-configurator 0.0.264 → 0.0.266

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.
@@ -145,6 +145,7 @@ function _toPrimitive(t, r) {
145
145
  const ProductCartTable = () => {
146
146
  const formula = (0, _FormulaContext.useFormula)();
147
147
  const isThc = formula === _constants__.CONFIGURATOR_FORMULAS.THC;
148
+ const isTowFormula = formula === _constants__.CONFIGURATOR_FORMULAS.TOW || formula === _constants__.CONFIGURATOR_FORMULAS.TM;
148
149
  const isTmg = (0, _useIsTmg.useIsTmg)();
149
150
  const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
150
151
  const [isToggled, setIsToggled] = (0, _react.useState)(false);
@@ -171,7 +172,8 @@ const ProductCartTable = () => {
171
172
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
172
173
 
173
174
  // Determine display mode
174
- const displayMode = (0, _cartTable2.getCartTableDisplayMode)(isToggled, isTmg);
175
+ const useTmgDisplayMode = isTmg && !isTowFormula;
176
+ const displayMode = (0, _cartTable2.getCartTableDisplayMode)(isToggled, useTmgDisplayMode);
175
177
  const handleVehicleCodingDiscountChange = function handleVehicleCodingDiscountChange(value) {
176
178
  let articleNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
177
179
  const sanitized = value === null || value === void 0 ? void 0 : value.toString().replace(/[^0-9]/g, '');
@@ -600,7 +602,8 @@ const ProductCartTable = () => {
600
602
  var _product$consumerDisc, _product$images, _product$images2;
601
603
  const isVehicleCodingProduct = (product === null || product === void 0 ? void 0 : product.subgroupName) === _constants__.VEHICLE_CODING_SUBGROUP_NAME || (product === null || product === void 0 ? void 0 : product.groupName) === _constants__.VEHICLE_CODING_SUBGROUP_NAME;
602
604
  const lineDiscountValue = (_product$consumerDisc = product === null || product === void 0 ? void 0 : product.consumerDiscountPercentage) !== null && _product$consumerDisc !== void 0 ? _product$consumerDisc : isVehicleCodingProduct ? vehicleCodingDiscountPercentage : 0;
603
- const discountInputCell = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD ? {
605
+ const allowLineDiscountMain = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD && (isTowmotive || isTowFormula);
606
+ const discountInputCellMain = allowLineDiscountMain ? {
604
607
  text: renderDiscountInput(product.articleNumber, lineDiscountValue, v => handleLineDiscountChange(product.articleNumber, v, {
605
608
  isVehicleCoding: isVehicleCodingProduct
606
609
  })),
@@ -619,7 +622,7 @@ const ProductCartTable = () => {
619
622
  extraCells: (0, _cartTable2.getMainProductCells)({
620
623
  displayMode,
621
624
  priceInfo: product.priceInfo,
622
- discountInputCell,
625
+ discountInputCell: discountInputCellMain,
623
626
  vehicleCodingInputCell,
624
627
  isVehicleCodingProduct
625
628
  })
@@ -650,7 +653,8 @@ const ProductCartTable = () => {
650
653
  }, accessoireProducts.map(product => {
651
654
  var _product$consumerDisc2, _product$images3, _product$images4;
652
655
  const lineDiscountValue = (_product$consumerDisc2 = product === null || product === void 0 ? void 0 : product.consumerDiscountPercentage) !== null && _product$consumerDisc2 !== void 0 ? _product$consumerDisc2 : null;
653
- const discountInputCell = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD ? {
656
+ const allowLineDiscountAccessory = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD && (isTowmotive || isTowFormula);
657
+ const discountInputCellAccessory = allowLineDiscountAccessory ? {
654
658
  text: renderDiscountInput(product.articleNumber, lineDiscountValue, v => handleLineDiscountChange(product.articleNumber, v)),
655
659
  className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
656
660
  } : {};
@@ -668,7 +672,7 @@ const ProductCartTable = () => {
668
672
  extraCells: (0, _cartTable2.getAccessoryProductCells)({
669
673
  displayMode,
670
674
  priceInfo: product.priceInfo,
671
- discountInputCell
675
+ discountInputCell: discountInputCellAccessory
672
676
  }),
673
677
  productAmount: selectedExtras[product.articleNumber],
674
678
  onEdit: value => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.264",
3
+ "version": "0.0.266",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",