@bytebrand/fe-ui-core 4.8.0 → 4.8.2

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.
@@ -47,7 +47,7 @@ describe('MaterialDatePicker', () => {
47
47
  fireEvent.click(okButton);
48
48
  fireEvent.focusOut(input);
49
49
 
50
- expect(handleChange).toHaveBeenCalledTimes(3);
50
+ expect(handleChange).toHaveBeenCalledTimes(4);
51
51
  expect(handleOpen).toHaveBeenCalledTimes(1);
52
52
  expect(handleBlur).toHaveBeenCalledTimes(1);
53
53
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.8.0",
3
+ "version": "4.8.2",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -65,7 +65,7 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
65
65
  },
66
66
  environmentEmissions: {
67
67
  co2: environmentEmissions.co2,
68
- wltpCo2: environmentEmissions.wltpCo2 || consumption.wltpCo2
68
+ wltpCo2: environmentEmissions.wltpCo2
69
69
  },
70
70
  consumption: {
71
71
  fuel: consumption.fuel,
@@ -68,7 +68,7 @@ export const transformDataForDecoratedCar = (car: any) => {
68
68
  tareWeight: _get(car, 'sizeVolumeWeight.emptyWeight', null),
69
69
  bootCapacity: _get(car, 'sizeVolumeWeight.cargoCapacity', null),
70
70
  capacityLoad: _get(car, 'sizeVolumeWeight.completeCapacity', null),
71
- wltpCo2: _get(car, 'consumption.wltpCo2', _get(car, 'environmentEmissions.wltpCo2')),
71
+ wltpCo2: _get(car, 'environmentEmissions.wltpCo2', null),
72
72
  pluginHybrid: _get(car, 'engineData.pluginHybrid', null),
73
73
  wltpCombined: _get(car, 'consumption.wltpCombined', _get(car, 'consumption.wltpWeightedCombined', null)),
74
74
  wltpPowerCombined: _get(car, 'consumption.wltpPowerCombined', _get(car, 'consumption.wltpWeightedPowerCombined', null)),
@@ -19,10 +19,6 @@ export const FIFTEEN = 15; // font-size
19
19
  export const FOURTEEN = 14;
20
20
  export const HUNDRED = 100;
21
21
  export const THOUSAND = 1000;
22
- export const WLTP_COMBINED_DEFAULT = 19.9;
23
- export const WLTP_POWER_COMBINED_DEFAULT = 29.9;
24
- export const WLTP_CO2_DEFAULT = 499;
25
- export const WLTP_CO2_ELECTRIC_DEFAULT = 0;
26
22
 
27
23
  export const CONTAINER_STYLES = {
28
24
  display: 'flex',
@@ -355,4 +355,14 @@ export interface IWltpConsumption {
355
355
  wltpPowerCombined?: number;
356
356
  wltpWeightedCombined?: number;
357
357
  wltpWeightedPowerCombined?: number;
358
+ }
359
+
360
+ export interface IFinancingUtils {
361
+ co2DefaultCostsLow: number;
362
+ co2DefaultCostsMedium: number;
363
+ co2DefaultCostsHigh: number;
364
+ getVehicleTax: (fuelType: string, cubicCapacity: number, co2: number, firstRegistration: number) => number;
365
+ getFuelPrice: (fuelSelector: string, consumption: IWltpConsumption, hybridPlugin?: boolean) => number;
366
+ getBaseFuelPrice: (fuelSelector: string, hybridPlugin?: boolean) => { fuelPrice: number, powerPrice?: number };
367
+ getCo2Price: (wltpCo2: number) => { co2PriceLow: number, co2PriceMedium: number, co2PriceHigh: number };
358
368
  }
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  // import { cbdGearbox, cbdFuel } from './cbdSelectors'
4
4
  import { formatMileage } from '../utils/CommonUtils';
5
5
  import { formatTimestamp } from '../utils/DateUtils';
6
- import { DELIVERY_PERIODS_EXTRA, WLTP_COMBINED_DEFAULT, WLTP_CO2_DEFAULT, WLTP_CO2_ELECTRIC_DEFAULT, WLTP_POWER_COMBINED_DEFAULT } from '../constants';
6
+ import { DELIVERY_PERIODS_EXTRA } from '../constants';
7
7
  import moment from 'moment';
8
8
  import { IDecoratedProp } from '../types/types';
9
9
 
@@ -122,7 +122,7 @@ const getDecoratedLightProps = (
122
122
  const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
123
123
  const translatedUnit = t(`cbd:${consumptionUnit}`);
124
124
  const wltpConsumptionCombined = car.consumption.wltpCombined || car.consumption.wltpWeightedCombined;
125
- const wltpCo2 = car.environmentEmissions.wltpCo2 || car.consumption.wltpCo2;
125
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
126
126
  const consumptionPowerCombined = car.consumption.consumptionCombined;
127
127
 
128
128
  const co2 = car.environmentEmissions.co2;
@@ -149,17 +149,6 @@ const getDecoratedLightProps = (
149
149
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
150
150
  : t('vehicleProps:value.na');
151
151
 
152
-
153
- const wltpCo2DefaultWtdValue = t('vehicleProps:value.wltpCo2WtdCombined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
154
- const wltpCo2DefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
155
- const wltpPowerCombinedDefaultValue = t('vehicleProps:value.wltpPowerCombined', { consumption: WLTP_POWER_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
156
- const wltpCombinedDefaultValue = t('vehicleProps:value.consumptionCombined', { consumption: WLTP_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
157
-
158
- const eightMonthsAgo = new Date();
159
- eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
160
-
161
- const registrationDate = new Date(firstRegistration * 1000);
162
-
163
152
  const hybridPlugin = car.engineData.hybridPlugin;
164
153
  const wltpWeightedPowerCombined = car.consumption.wltpWeightedPowerCombined;
165
154
  const wltpWeightedCombined = car.consumption.wltpWeightedCombined;
@@ -175,13 +164,7 @@ const getDecoratedLightProps = (
175
164
  {wltpCo2PluginValue}
176
165
  </React.Fragment>
177
166
  }
178
- if ((!wltpWeightedPowerCombinedContent || !wltpWeightedCombinedContent || !wltpCo2PluginValue) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
179
- return <React.Fragment>
180
- {`${wltpPowerCombinedDefaultValue}, `}
181
- {`${wltpCombinedDefaultValue}, `}
182
- {wltpCo2DefaultWtdValue}
183
- </React.Fragment>
184
- }
167
+
185
168
  return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
186
169
  ? <React.Fragment>
187
170
  {consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionValue} <br /> {co2Value}
@@ -194,10 +177,6 @@ const getDecoratedLightProps = (
194
177
  return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
195
178
  }
196
179
 
197
- if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
198
- return <>{wltpCombinedDefaultValue} {wltpCo2DefaultValue}</>;
199
- }
200
-
201
180
  return <>{consumptionValue} <br /> {co2Value}</>;
202
181
  }
203
182
  },
@@ -211,15 +190,7 @@ const getDecoratedLightProps = (
211
190
  const translatedUnit = t(`cbd:${consumptionUnit}`);
212
191
  const co2 = car.environmentEmissions.co2;
213
192
  const wltpConsumptionPowerCombined = car.consumption.wltpPowerCombined || car.consumption.wltpWeightedPowerCombined;
214
- const wltpCo2 = car.consumption.wltpCo2 || car.environmentEmissions.wltpCo2;
215
-
216
- const wltpCo2ElectricDefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_ELECTRIC_DEFAULT.toLocaleString(language) });
217
- const wltpPowerCombinedDefaultValue = t('vehicleProps:value.wltpPowerCombined', { consumption: WLTP_POWER_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
218
-
219
- const eightMonthsAgo = new Date();
220
- eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
221
-
222
- const registrationDate = new Date(firstRegistration * 1000);
193
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
223
194
 
224
195
  const wltpConsumptionValue = Number.isFinite(wltpConsumptionPowerCombined)
225
196
  ? t('vehicleProps:value.wltpPowerCombined', { consumption: wltpConsumptionPowerCombined.toLocaleString(language), unit: translatedUnit })
@@ -241,10 +212,6 @@ const getDecoratedLightProps = (
241
212
  return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
242
213
  }
243
214
 
244
- if ((!wltpConsumptionValue && !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
245
- return <>{wltpPowerCombinedDefaultValue}, {wltpCo2ElectricDefaultValue}</>;
246
- }
247
-
248
215
  return <>{consumptionValue} <br /> {co2Value} </>;
249
216
  }
250
217
  },
@@ -277,7 +244,7 @@ const getDecoratedLightProps = (
277
244
  : null;
278
245
 
279
246
  const co2 = car.environmentEmissions.co2;
280
- const wltpCo2 = car.consumption.wltpCo2 || car.environmentEmissions.wltpCo2;
247
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
281
248
 
282
249
  const co2Value = Number.isFinite(co2)
283
250
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
@@ -291,15 +258,6 @@ const getDecoratedLightProps = (
291
258
  ? t('vehicleProps:value.wltpCo2WtdCombined', { co2: wltpCo2.toLocaleString(language), unit: translatedUnit })
292
259
  : null;
293
260
 
294
- const wltpCo2DefaultWtdValue = t('vehicleProps:value.wltpCo2WtdCombined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
295
- const wltpCo2DefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
296
- const wltpPowerCombinedDefaultValue = t('vehicleProps:value.wltpPowerCombined', { consumption: WLTP_POWER_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
297
- const wltpCombinedDefaultValue = t('vehicleProps:value.consumptionCombined', { consumption: WLTP_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
298
-
299
- const eightMonthsAgo = new Date();
300
- eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
301
- const registrationDate = new Date(firstRegistration * 1000);
302
-
303
261
  const hybridPlugin = car.engineData.hybridPlugin;
304
262
 
305
263
  if (hybridPlugin) {
@@ -310,13 +268,6 @@ const getDecoratedLightProps = (
310
268
  {wltpCo2PluginValue}
311
269
  </React.Fragment>
312
270
  }
313
- if ((!wltpWeightedPowerCombinedContent || !wltpWeightedCombinedContent || !wltpCo2PluginValue) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
314
- return <React.Fragment>
315
- {`${wltpPowerCombinedDefaultValue}, `}
316
- {`${wltpCombinedDefaultValue}, `}
317
- {wltpCo2DefaultWtdValue}
318
- </React.Fragment>
319
- }
320
271
  }
321
272
 
322
273
  if (wltpConsumptionPowerCombinedContent && wltpConsumptionCombinedContent && wltpCo2Value) {
@@ -327,13 +278,6 @@ const getDecoratedLightProps = (
327
278
  </React.Fragment>
328
279
  }
329
280
 
330
- if ((!wltpConsumptionPowerCombinedContent || !wltpConsumptionCombinedContent || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
331
- return <React.Fragment>
332
- {`${wltpCombinedDefaultValue}, `}
333
- {wltpCo2DefaultValue}
334
- </React.Fragment>
335
- }
336
-
337
281
  return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
338
282
  ? <React.Fragment>
339
283
  {consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionCombinedContent} <br /> {co2Value}
@@ -352,7 +296,7 @@ const getDecoratedLightProps = (
352
296
  const translatedUnit = t(`cbd:${consumptionUnit}`);
353
297
  const co2 = car.environmentEmissions.co2;
354
298
  const wltpConsumptionCombined = car.consumption.wltpCombined;
355
- const wltpCo2 = car.consumption.wltpCo2 || car.environmentEmissions.wltpCo2;
299
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
356
300
 
357
301
  const consumptionValue = Number.isFinite(consumptionHydrogenCombined)
358
302
  ? t('vehicleProps:value.consumptionGas', { consumption: consumptionHydrogenCombined.toLocaleString(language), unit: translatedUnit })
@@ -369,21 +313,10 @@ const getDecoratedLightProps = (
369
313
  ? t('vehicleProps:value.wltpCo2Combined', { co2: wltpCo2.toLocaleString(language) })
370
314
  : null;
371
315
 
372
- const wltpCo2DefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
373
- const wltpCombinedDefaultValue = t('vehicleProps:value.wltpCombinedGas', { consumption: WLTP_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
374
-
375
- const eightMonthsAgo = new Date();
376
- eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
377
- const registrationDate = new Date(firstRegistration * 1000);
378
-
379
316
  if (wltpConsumptionValue && wltpCo2Value) {
380
317
  return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
381
318
  }
382
319
 
383
- if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
384
- return <>{wltpCombinedDefaultValue}, {wltpCo2DefaultValue}</>;
385
- }
386
-
387
320
  return <>{consumptionValue} <br /> {co2Value}</>;
388
321
  }
389
322
  },
@@ -397,7 +330,7 @@ const getDecoratedLightProps = (
397
330
  const translatedUnit = t(`cbd:${consumptionUnit}`);
398
331
  const co2 = car.environmentEmissions.co2;
399
332
  const wltpConsumptionCombined = car.consumption.wltpCombined;
400
- const wltpCo2 = car.consumption.wltpCo2 || car.environmentEmissions.wltpCo2;
333
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
401
334
 
402
335
  const consumptionValue = Number.isFinite(consumptionGasCombined)
403
336
  ? t('vehicleProps:value.consumptionGas', { consumption: consumptionGasCombined.toLocaleString(language), unit: translatedUnit })
@@ -415,21 +348,10 @@ const getDecoratedLightProps = (
415
348
  ? t('vehicleProps:value.wltpCo2Combined', { co2: wltpCo2.toLocaleString(language) })
416
349
  : null;
417
350
 
418
- const wltpCo2DefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
419
- const wltpCombinedDefaultValue = t('vehicleProps:value.wltpCombinedGas', { consumption: WLTP_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
420
-
421
- const eightMonthsAgo = new Date();
422
- eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
423
- const registrationDate = new Date(firstRegistration * 1000);
424
-
425
351
  if (wltpConsumptionValue && wltpCo2Value) {
426
352
  return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
427
353
  }
428
354
 
429
- if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
430
- return <>{wltpCombinedDefaultValue}, {wltpCo2DefaultValue}</>;
431
- }
432
-
433
355
  return <>{consumptionValue} <br /> {co2Value}</>;
434
356
  }
435
357
  },
@@ -7,9 +7,8 @@ import { formatTimestamp } from '../utils/DateUtils';
7
7
  import { formatMileage } from '../utils/CommonUtils';
8
8
  import { EMISSION_STICKERS_ICONS, WP_EMISSION_STICKERS_ICONS } from '../constants/Search';
9
9
  import { DELIVERY_PERIODS_EXTRA } from '../constants';
10
- import { IDecoratedProp, ICar } from '../types/types';
10
+ import { IDecoratedProp, ICar, IFinancingUtils } from '../types/types';
11
11
  import { getFormattedPrice } from '../utils/CommonUtils';
12
- import { IWltpConsumption } from '../types/types';
13
12
 
14
13
  const formatDeliveryPeriod = (t: (key: string, options?: object) => string, deliveryPeriod: string) => {
15
14
  const count: number = +DELIVERY_PERIODS_EXTRA.find((period: any) => period.value === deliveryPeriod).label;
@@ -73,8 +72,7 @@ const getDecoratedProps = (
73
72
  t: (key: string, options?: object) => string,
74
73
  language: string = 'en',
75
74
  simplifiedLabels: boolean = false, // shortened labels for repsonsive layout (see 'power'),
76
- getFuelPrice?: (fuelSelector: string, consumption: IWltpConsumption, hybridPlugin?: boolean) => number,
77
- getVehicleTax?: (fuelType: string, cubicCapacity: number, co2: number, firstRegistration: number) => number
75
+ financingUtils?: IFinancingUtils
78
76
  ): IDecoratedProp => {
79
77
  const {
80
78
  offer = {},
@@ -1171,7 +1169,7 @@ const getDecoratedProps = (
1171
1169
  wltpCo2Discharged: {
1172
1170
  title: t('vehicleProps:title.wltpCo2Discharged'),
1173
1171
  get value() {
1174
- const wltpCo2 = car.environmentEmissions.wltpCo2Discharged;
1172
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
1175
1173
  const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1176
1174
  const translatedUnit = t(`cbd:${consumptionUnit}`);
1177
1175
  return Number.isFinite(wltpCo2)
@@ -1550,43 +1548,69 @@ const getDecoratedProps = (
1550
1548
  const consumption = {
1551
1549
  wltpCombined, wltpPowerCombined, wltpWeightedCombined, wltpWeightedPowerCombined
1552
1550
  }
1551
+ const { getFuelPrice } = financingUtils;
1553
1552
  const fuelCost = getFuelPrice(fuel, consumption, hybridPlugin);
1554
1553
  return Number.isFinite(fuelCost)
1555
- ? t('vehicleProps:value.price', { price: getFormattedPrice(fuelCost, '$,.2f') })
1554
+ ? t('vehicleProps:value.pricePerYear', { price: getFormattedPrice(fuelCost, '$,.2f') })
1556
1555
  : t('vehicleProps:value.na');
1557
1556
  }
1558
1557
  },
1559
1558
  wltpCo2CostsLow: {
1560
- title: t('vehicleProps:title.wltpCo2LowPrice'),
1559
+ get title() {
1560
+ const { co2DefaultCostsLow } = financingUtils;
1561
+ return t('vehicleProps:title.wltpCo2LowPrice', { price: co2DefaultCostsLow })
1562
+ },
1561
1563
  get value() {
1562
- const basePrice = car.costModel.co2Costs.low.basePrice || 30;
1563
- return Number.isFinite(basePrice)
1564
- ? t('vehicleProps:value.price', { price: getFormattedPrice(basePrice, '$,.2f') })
1564
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
1565
+
1566
+ const { getCo2Price } = financingUtils;
1567
+ const { co2PriceLow } = getCo2Price(wltpCo2);
1568
+ return Number.isFinite(co2PriceLow)
1569
+ ? t('vehicleProps:value.wltpCo2Price', { price: getFormattedPrice(co2PriceLow, '$,.2f') })
1565
1570
  : t('vehicleProps:value.na');
1566
1571
  }
1567
1572
  },
1568
1573
  wltpCo2CostsMiddle: {
1569
- title: t('vehicleProps:title.wltpCo2MidPrice'),
1574
+ get title() {
1575
+ const { co2DefaultCostsMedium } = financingUtils;
1576
+ return t('vehicleProps:title.wltpCo2MidPrice', { price: co2DefaultCostsMedium })
1577
+ },
1570
1578
  get value() {
1571
- const basePrice = car.costModel.co2Costs.middle.basePrice || 50;
1572
- return Number.isFinite(basePrice)
1573
- ? t('vehicleProps:value.price', { price: getFormattedPrice(basePrice, '$,.2f') })
1579
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
1580
+
1581
+ const { getCo2Price } = financingUtils;
1582
+ const { co2PriceMedium } = getCo2Price(wltpCo2);
1583
+ return Number.isFinite(co2PriceMedium)
1584
+ ? t('vehicleProps:value.wltpCo2Price', { price: getFormattedPrice(co2PriceMedium, '$,.2f') })
1574
1585
  : t('vehicleProps:value.na');
1575
1586
  }
1576
1587
  },
1577
1588
  wltpCo2CostsHigh: {
1578
- title: t('vehicleProps:title.wltpCo2HighPrice'),
1589
+ get title() {
1590
+ const { co2DefaultCostsHigh } = financingUtils;
1591
+ return t('vehicleProps:title.wltpCo2HighPrice', { price: co2DefaultCostsHigh })
1592
+ },
1579
1593
  get value() {
1580
- const basePrice = car.costModel.co2Costs.high.basePrice || 70;
1581
- return Number.isFinite(basePrice)
1582
- ? t('vehicleProps:value.price', { price: getFormattedPrice(basePrice, '$,.2f') })
1594
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
1595
+
1596
+ const { getCo2Price } = financingUtils;
1597
+ const { co2PriceHigh } = getCo2Price(wltpCo2);
1598
+ return Number.isFinite(co2PriceHigh)
1599
+ ? t('vehicleProps:value.wltpCo2Price', { price: getFormattedPrice(co2PriceHigh, '$,.2f') })
1583
1600
  : t('vehicleProps:value.na');
1584
1601
  }
1585
1602
  },
1586
1603
  powerPrice: {
1587
1604
  title: t('vehicleProps:title.powerPrice'),
1588
1605
  get value() {
1589
- const { powerPrice } = car.costModel;
1606
+ const fuel = car.consumption.fuel;
1607
+ const { hybridPlugin } = car.engineData;
1608
+
1609
+ const { getBaseFuelPrice } = financingUtils;
1610
+
1611
+ const basePowerPrice = getBaseFuelPrice(fuel, hybridPlugin).powerPrice;
1612
+ const powerPrice = car.costModel.powerPrice ? car.costModel.powerPrice : basePowerPrice;
1613
+
1590
1614
  return Number.isFinite(powerPrice)
1591
1615
  ? t('vehicleProps:value.powerPrice', { price: getFormattedPrice(powerPrice, '$,.2f') })
1592
1616
  : t('vehicleProps:value.na');
@@ -1596,21 +1620,13 @@ const getDecoratedProps = (
1596
1620
  title: t('vehicleProps:title.fuelPrice'),
1597
1621
  get value() {
1598
1622
  const fuel = car.consumption.fuel;
1599
- const wltpCombined = car.consumption.wltpCombined || car.consumption.wltpWeightedCombined;
1600
- const wltpPowerCombined = car.consumption.wltpPowerCombined || car.consumption.wltpWeightedPowerCombined;
1601
- const wltpWeightedCombined = car.consumption.wltpWeightedCombined;
1602
- const wltpWeightedPowerCombined = car.consumption.wltpWeightedPowerCombined;
1623
+ const { hybridPlugin } = car.engineData;
1603
1624
 
1604
- const wltpConsumption = {
1605
- wltpCombined,
1606
- wltpPowerCombined,
1607
- wltpWeightedCombined,
1608
- wltpWeightedPowerCombined
1609
- };
1625
+ const { getBaseFuelPrice } = financingUtils;
1610
1626
 
1611
- const { hybridPlugin } = car.engineData;
1627
+ const baseFuelPrice = getBaseFuelPrice(fuel, hybridPlugin);
1612
1628
 
1613
- const fuelPrice = car.costModel.fuelPrice ? car.costModel.fuelPrice : getFuelPrice(fuel, wltpConsumption, hybridPlugin);
1629
+ const fuelPrice = car.costModel.fuelPrice ? car.costModel.fuelPrice : baseFuelPrice;
1614
1630
  return Number.isFinite(fuelPrice)
1615
1631
  ? t('vehicleProps:value.fuelPrice', { price: getFormattedPrice(fuelPrice, '$,.2f') })
1616
1632
  : t('vehicleProps:value.na');
@@ -1631,6 +1647,7 @@ const getDecoratedProps = (
1631
1647
  const cubicCapacity = car.engineData.cubicCapacity;
1632
1648
  const fuel = car.consumption.fuel;
1633
1649
  const wltpCo2 = car.environmentEmissions.wltpCo2;
1650
+ const { getVehicleTax } = financingUtils;
1634
1651
  const tax = car.costModel.tax ? car.costModel.tax : getVehicleTax(fuel, cubicCapacity, wltpCo2, firstRegistration);
1635
1652
  return Number.isFinite(tax)
1636
1653
  ? t('vehicleProps:value.price', { price: getFormattedPrice(tax, '$,.2f') })
@@ -48,7 +48,7 @@ const environmentPluginHybridWLTP = ['wltpWeightedCombined', 'wltpTotalRange', '
48
48
  'fuelPrice', 'powerPrice', 'consumptionPriceYear', 'wltpEnergyEfficiencyClass'];
49
49
  const environmentElectroBenzinDieselEthanolHybridWLTP = ['wltpCombined', 'wltpCo2', 'wltpSlow', 'wltpMedium', 'wltpFast', 'wltpVeryFast', 'fuelPrice', 'consumptionPriceYear', 'wltpEnergyEfficiencyClass'];
50
50
  const environmentHydrogenWLTP = ['wltpCombinedGas', 'wltpCo2', 'wltpSlowGas', 'wltpMediumGas', 'wltpFastGas', 'wltpVeryFastGas', 'fuelPrice', 'consumptionPriceYear', 'wltpEnergyEfficiencyClass'];
51
- const costModel = ['wltpEnergyCosts', 'wltpCo2CostsLow', 'wltpCo2CostsMiddle', 'wltpCo2CostsHigh', 'wltpCostModelTax'];
51
+ const costModel = ['wltpEnergyCosts', 'wltpCo2CostsMiddle', 'wltpCo2CostsLow', 'wltpCo2CostsHigh', 'wltpCostModelTax'];
52
52
 
53
53
  export const engineDetails: IEngineDetails = [
54
54
  {