@bytebrand/fe-ui-core 4.8.6 → 4.8.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.8.6",
3
+ "version": "4.8.7",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -363,7 +363,7 @@ export interface IFinancingUtils {
363
363
  co2DefaultCostsMedium: number;
364
364
  co2DefaultCostsHigh: number;
365
365
  getVehicleTax: (fuelType: string, cubicCapacity: number, co2: number, firstRegistration: number) => number;
366
- getFuelPrice: (fuelSelector: string, consumption: IWltpConsumption, hybridPlugin?: boolean) => number;
366
+ getFuelPrice: (fuelSelector: string, consumption: IWltpConsumption, hybridPlugin: boolean, powerCost: { fuelPrice?: number, powerPrice?: number }) => number;
367
367
  getBaseFuelPrice: (fuelSelector: string, hybridPlugin?: boolean) => { fuelPrice: number, powerPrice?: number };
368
368
  getCo2Price: (wltpCo2: number) => { co2PriceLow: number, co2PriceMedium: number, co2PriceHigh: number };
369
369
  }
@@ -1169,7 +1169,7 @@ const getDecoratedProps = (
1169
1169
  wltpCo2Discharged: {
1170
1170
  title: t('vehicleProps:title.wltpCo2Discharged'),
1171
1171
  get value() {
1172
- const wltpCo2 = car.environmentEmissions.wltpCo2;
1172
+ const wltpCo2 = car.environmentEmissions.wltpCo2Discharged;
1173
1173
  const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1174
1174
  const translatedUnit = t(`cbd:${consumptionUnit}`);
1175
1175
  return Number.isFinite(wltpCo2)
@@ -1544,12 +1544,17 @@ const getDecoratedProps = (
1544
1544
  get value() {
1545
1545
  const { fuel } = car.consumption;
1546
1546
  const { wltpCombined, wltpPowerCombined, wltpWeightedCombined, wltpWeightedPowerCombined } = car.consumption;
1547
+ const { powerPrice, fuelPrice } = car.costModel;
1548
+ const powerCost = {
1549
+ fuelPrice,
1550
+ powerPrice
1551
+ }
1547
1552
  const { hybridPlugin } = car.engineData;
1548
1553
  const consumption = {
1549
1554
  wltpCombined, wltpPowerCombined, wltpWeightedCombined, wltpWeightedPowerCombined
1550
1555
  }
1551
1556
  const { getFuelPrice } = financingUtils;
1552
- const fuelCost = getFuelPrice(fuel, consumption, hybridPlugin);
1557
+ const fuelCost = getFuelPrice(fuel, consumption, hybridPlugin, powerCost);
1553
1558
  return Number.isFinite(fuelCost)
1554
1559
  ? t('vehicleProps:value.pricePerYear', { price: getFormattedPrice(fuelCost, '$,.2f') })
1555
1560
  : t('vehicleProps:value.na');
@@ -1627,7 +1632,7 @@ const getDecoratedProps = (
1627
1632
 
1628
1633
  const { getBaseFuelPrice } = financingUtils;
1629
1634
 
1630
- const baseFuelPrice = getBaseFuelPrice(fuel, hybridPlugin).fuelPrice;
1635
+ const baseFuelPrice = getBaseFuelPrice(fuel, hybridPlugin) ? getBaseFuelPrice(fuel, hybridPlugin).fuelPrice : null;
1631
1636
 
1632
1637
  const fuelPrice = car.costModel.fuelPrice ? car.costModel.fuelPrice : baseFuelPrice;
1633
1638
  return Number.isFinite(fuelPrice)
@@ -1653,7 +1658,7 @@ const getDecoratedProps = (
1653
1658
  const { getVehicleTax } = financingUtils;
1654
1659
  const tax = car.costModel.tax ? car.costModel.tax : getVehicleTax(fuel, cubicCapacity, wltpCo2, firstRegistration);
1655
1660
  return Number.isFinite(tax)
1656
- ? t('vehicleProps:value.price', { price: getFormattedPrice(tax, '$,.2f') })
1661
+ ? t('vehicleProps:value.pricePerYear', { price: getFormattedPrice(tax, '$,.2f') })
1657
1662
  : t('vehicleProps:value.na');
1658
1663
  }
1659
1664
  }
@@ -8,7 +8,7 @@ import { sortingOptions } from './sortingOptions';
8
8
  import { transformDataForDecoratedCar } from '../framework/DataTransformers'
9
9
  import moment from 'moment';
10
10
  import { DELIVERY_PERIODS_EXTRA } from '../framework/constants';
11
- import { getFormattedPrice } from '../framework/utils/CommonUtils';
11
+ import { getFormattedNumber, getFormattedPrice } from '../framework/utils/CommonUtils';
12
12
 
13
13
  export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
14
14
  const vehicleOption = transformDataForDecoratedCar(car);
@@ -84,11 +84,11 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
84
84
  no: 'Nein',
85
85
  yes: 'Ja',
86
86
  batteryCapacity: `${vehicleOption.batteryCapacity} kWh`,
87
- wltpCo2Combined: `${vehicleOption.wltpCo2}g CO2/km (WLTP, komb)*`,
88
- wltpCo2WtdCombined: `${vehicleOption.wltpCo2}g CO2/km (WLTP, gew., komb)*`,
89
- wltpCombined: `${vehicleOption.wltpCombined || vehicleOption.wltpWeightedCombined}l/100km`,
90
- wltpPowerCombined: `${vehicleOption.wltpPowerCombined || vehicleOption.wltpWeightedPowerCombined}kWh/100km`,
91
- wltpCombinedGas: `${vehicleOption.wltpCombined || vehicleOption.wltpWeightedCombined}kg/100km`
87
+ wltpCo2Combined: `${getFormattedNumber(vehicleOption.wltpCo2)}g CO2/km (WLTP, komb)*`,
88
+ wltpCo2WtdCombined: `${getFormattedNumber(vehicleOption.wltpCo2)}g CO2/km (WLTP, gew., komb)*`,
89
+ wltpCombined: `${getFormattedNumber(vehicleOption.wltpCombined) || getFormattedNumber(vehicleOption.wltpWeightedCombined)}l/100km`,
90
+ wltpPowerCombined: `${getFormattedNumber(vehicleOption.wltpPowerCombined) || getFormattedNumber(vehicleOption.wltpWeightedPowerCombined)}kWh/100km`,
91
+ wltpCombinedGas: `${getFormattedNumber(vehicleOption.wltpCombined) || getFormattedNumber(vehicleOption.wltpWeightedCombined)}kg/100km`
92
92
  },
93
93
  title: {
94
94
  'addOfferToMainSlide': 'Zum Schieberegler hinzufügen',